OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import os | 5 # pylint: disable=unused-wildcard-import |
| 6 # pylint: disable=wildcard-import |
6 | 7 |
7 | 8 from devil.utils.host_utils import * |
8 def GetRecursiveDiskUsage(path): | |
9 """Returns the disk usage in bytes of |path|. Similar to `du -sb |path|`.""" | |
10 running_size = os.path.getsize(path) | |
11 if os.path.isdir(path): | |
12 for root, dirs, files in os.walk(path): | |
13 running_size += sum([os.path.getsize(os.path.join(root, f)) | |
14 for f in files + dirs]) | |
15 return running_size | |
16 | |
OLD | NEW |