diff options
author | Guido van Rossum <guido@python.org> | 1992-08-31 10:54:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-08-31 10:54:54 (GMT) |
commit | 61700bb985ce2708f489dae6397cf4be3e934d1a (patch) | |
tree | 95b733b631ab7a21efd3d3ed4887b5bc959dc49d /Tools/scripts | |
parent | 0b2b440a13ee1b9c0719e246ae4ec08a8efd5519 (diff) | |
download | cpython-61700bb985ce2708f489dae6397cf4be3e934d1a.zip cpython-61700bb985ce2708f489dae6397cf4be3e934d1a.tar.gz cpython-61700bb985ce2708f489dae6397cf4be3e934d1a.tar.bz2 |
cope with filenames containing spaces
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/dutree.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Tools/scripts/dutree.py b/Tools/scripts/dutree.py index a39f172..d3c905e 100755 --- a/Tools/scripts/dutree.py +++ b/Tools/scripts/dutree.py @@ -7,8 +7,11 @@ def main(): p = os.popen('du ' + string.join(sys.argv[1:]), 'r') total, d = None, {} for line in p.readlines(): - [num, file] = string.split(line) - size = eval(num) + i = 0 + while line[i] in '0123456789': i = i+1 + size = eval(line[:i]) + while line[i] in ' \t': i = i+1 + file = line[i:-1] comps = string.splitfields(file, '/') if comps[0] == '': comps[0] = '/' if comps[len(comps)-1] == '': del comps[len(comps)-1] |