Convert du output to MB/GB...?
After calculating size with du for several folders, of about 600MB
giving me: 673996771 Code:
TOTAL_SIZEH=`echo "$TOTAL_SIZE" | awk '{ sum=$1 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}'` thanks a lot ! |
du -h not working for you?
|
Quote:
Code:
directory1 |
This should work:
Code:
tr "\n" "\000" < myfiles.lst | du -h --files0-from=- If you want the total for a directory, you probably want the -s flag too (du -sh --files0-from=-). |
Quote:
Sorry but however it does not summarize the total of size... Above into TOTAL_SIZEH my awk version. However I guess one can do : Code:
tr "\n" "\000" < myfile | du -b --files0-from=- | awk ' { print $1 } ' |
I've never been a fan of "-h" (for "du") - messes with the output too much. I prefer to leave it as-is and sort it (numerically). Usually looking for the biggest space hog, so reverse sorted.
For the total, awk should do nicely - again, I just pick a unit of measure and use that. KISS. |
Quote:
|
Hey, you are *good* .... :p
I'll pinch that ... bloody manpages ... ;) |
Quote:
Code:
tr "\n" "\000" < myfile | du -ch --files0-from=- | awk '/total$/ {print $1}' |
Quote:
I would like to thank you very much! link |
All times are GMT -5. The time now is 04:40 AM. |