K
Kirk Job-Sluder
Hrm, I'm a bit stumped on this.
I want to write a script lists a file directory hierarchy and gives me a
sorted list showing cumulative directory size. The example code for
os.walk gets me half-way there, but I can't quite figure out how to do
the hierarchal sum. Here is the output I'm getting:
/home/kirk/.gconf/apps/ggv/layout consumes 228 bytes in 1 non-directory
files
/home/kirk/.gconf/apps/ggv consumes 0 bytes in 1 non-directory files
/home/kirk/.gconf/apps consumes 0 bytes in 1 non-directory files
However, what I want is:
/home/kirk/.gconf/apps/ggv/layout consumes 228 bytes in 1 non-directory
files
/home/kirk/.gconf/apps/ggv consumes 228 bytes in 1 non-directory files
/home/kirk/.gconf/apps consumes 228 bytes in 1 non-directory files
There should be an easy way to get around this, or perhaps I'm better
off just parsing the output of du.
I want to write a script lists a file directory hierarchy and gives me a
sorted list showing cumulative directory size. The example code for
os.walk gets me half-way there, but I can't quite figure out how to do
the hierarchal sum. Here is the output I'm getting:
/home/kirk/.gconf/apps/ggv/layout consumes 228 bytes in 1 non-directory
files
/home/kirk/.gconf/apps/ggv consumes 0 bytes in 1 non-directory files
/home/kirk/.gconf/apps consumes 0 bytes in 1 non-directory files
However, what I want is:
/home/kirk/.gconf/apps/ggv/layout consumes 228 bytes in 1 non-directory
files
/home/kirk/.gconf/apps/ggv consumes 228 bytes in 1 non-directory files
/home/kirk/.gconf/apps consumes 228 bytes in 1 non-directory files
There should be an easy way to get around this, or perhaps I'm better
off just parsing the output of du.