OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import os |
| 6 |
| 7 |
| 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 |