OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
6 // filesystem. | 6 // filesystem. |
7 | 7 |
8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 int CountFilesCreatedAfter(const FilePath& path, | 75 int CountFilesCreatedAfter(const FilePath& path, |
76 const base::Time& file_time); | 76 const base::Time& file_time); |
77 | 77 |
78 // Returns the total number of bytes used by all the files under |root_path|. | 78 // Returns the total number of bytes used by all the files under |root_path|. |
79 // If the path does not exist the function returns 0. | 79 // If the path does not exist the function returns 0. |
80 // | 80 // |
81 // This function is implemented using the FileEnumerator class so it is not | 81 // This function is implemented using the FileEnumerator class so it is not |
82 // particularly speedy in any platform. | 82 // particularly speedy in any platform. |
83 int64 ComputeDirectorySize(const FilePath& root_path); | 83 int64 ComputeDirectorySize(const FilePath& root_path); |
84 | 84 |
| 85 // Returns the total number of bytes used by all files matching the provided |
| 86 // |pattern|, on this |directory| (without recursion). If the path does not |
| 87 // exist the function returns 0. |
| 88 // |
| 89 // This function is implemented using the FileEnumerator class so it is not |
| 90 // particularly speedy in any platform. |
| 91 int64 ComputeFilesSize(const FilePath& directory, |
| 92 const FilePath::StringType& pattern); |
| 93 |
85 // Deletes the given path, whether it's a file or a directory. | 94 // Deletes the given path, whether it's a file or a directory. |
86 // If it's a directory, it's perfectly happy to delete all of the | 95 // If it's a directory, it's perfectly happy to delete all of the |
87 // directory's contents. Passing true to recursive deletes | 96 // directory's contents. Passing true to recursive deletes |
88 // subdirectories and their contents as well. | 97 // subdirectories and their contents as well. |
89 // Returns true if successful, false otherwise. | 98 // Returns true if successful, false otherwise. |
90 // | 99 // |
91 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT | 100 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT |
92 // TO "rm -rf", SO USE WITH CAUTION. | 101 // TO "rm -rf", SO USE WITH CAUTION. |
93 bool Delete(const FilePath& path, bool recursive); | 102 bool Delete(const FilePath& path, bool recursive); |
94 | 103 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 588 |
580 #endif // UNIT_TEST | 589 #endif // UNIT_TEST |
581 | 590 |
582 } // namespace file_util | 591 } // namespace file_util |
583 | 592 |
584 // Deprecated functions have been moved to this separate header file, | 593 // Deprecated functions have been moved to this separate header file, |
585 // which must be included last after all the above definitions. | 594 // which must be included last after all the above definitions. |
586 #include "base/file_util_deprecated.h" | 595 #include "base/file_util_deprecated.h" |
587 | 596 |
588 #endif // BASE_FILE_UTIL_H_ | 597 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |