[opensuse] Help - Brain is Stuck: how to show disk usage for a filespec spanning multiple directories?
Listmates, I must be having one of my moments... As a result of some encoding where I kept the intermediate .wav files, I now have .wav file spread out over multiple directories. I simply want to get a total on how much disk space they are taking. I don't want to delete them, I just want to know whether I'm talking about 1 gig or 201 gigs. I have looked at ls -R, du, and nothing jumps out at being able to do this. What I want to do is something like: du -hcs ~/music/*.wav But obviously that doesn't work because du doesn't handle the filespec part. Does anybody know what I'm looking for? I guess I'll just stick it in find and do something like | xargs -0 (( +=filesize )). But if you know of the silver bullet, please post it. Thanks! -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
Listmates,
I must be having one of my moments... As a result of some encoding where I kept the intermediate .wav files, I now have .wav file spread out over multiple directories. I simply want to get a total on how much disk space they are taking. I don't want to delete them, I just want to know whether I'm talking about 1 gig or 201 gigs.
find <dir> -iname \*.jpeg -print0 | du -hc --files0-from=- | tail -1 /Per -- Per Jessen, Zürich (16.6°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
Listmates,
I must be having one of my moments... As a result of some encoding where I kept the intermediate .wav files, I now have .wav file spread out over multiple directories. I simply want to get a total on how much disk space they are taking. I don't want to delete them, I just want to know whether I'm talking about 1 gig or 201 gigs. I have looked at ls -R, du, and nothing jumps out at being able to do this. What I want to do is something like:
du -hcs ~/music/*.wav
But obviously that doesn't work because du doesn't handle the filespec part. Does anybody know what I'm looking for? I guess I'll just stick it in find and do something like | xargs -0 (( +=filesize )). But if you know of the silver bullet, please post it. Thanks!
find ./music -name '*.wav' -printf "%s\n" |awk 'BEGIN{n=0}{n+=$1}END{print n}' or find ./music -name '*.wav' -printf "%b\n" |awk 'BEGIN{n=0}{n+=$1}END{print n*512}' Kinda fugly but possible without awk too: Actual bytes of data you care about: n=0 ;find ./music -name '*.wav' -printf "%s\n" \ |while read x ;do n=$((n+$x)) ;echo $n ;done \ |tail -1 Bytes used, including wasted space in partial blocks: n=0 ;find ./music -name '*.wav' -printf "%b\n" \ |while read x ;do n=$((n+$x)) ;echo $((n*512)) ;done \ |tail -1 -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
Listmates,
I must be having one of my moments... As a result of some encoding where I kept the intermediate .wav files, I now have .wav file spread out over multiple directories. I simply want to get a total on how much disk space they are taking. I don't want to delete them, I just want to know whether I'm talking about 1 gig or 201 gigs. I have looked at ls -R, du, and nothing jumps out at being able to do this. What I want to do is something like:
du -hcs ~/music/*.wav
But obviously that doesn't work because du doesn't handle the filespec part. Does anybody know what I'm looking for? I guess I'll just stick it in find and do something like | xargs -0 (( +=filesize )). But if you know of the silver bullet, please post it. Thanks!
Heck I missed an easier way, fancy gnu du features... find ./ -name 'prc.*' -print0 |du -hc --files0-from=- -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Heck I missed an easier way, fancy gnu du features...
find ./ -name 'prc.*' -print0 |du -hc --files0-from=-
*sigh* of course that was supposed to be find ./music -name '*.wav' -print0 |du -hc --files0-from=- -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday 08 May 2009 02:28:25 Brian K. White wrote:
Heck I missed an easier way, fancy gnu du features...
find ./ -name 'prc.*' -print0 |du -hc --files0-from=-
*sigh* of course that was supposed to be find ./music -name '*.wav' -print0 |du -hc --files0-from=-
-- bkw
Per, Brian, Thank you both for the find and awk solutions. That allowed my stuck brain enough of a rest to take the wife, mother-in-law and all kids to the Tutankhamun and the Golden Age of the Pharaohs display at the Dallas Museum of Art Friday. (...personally, I think I would rather have.....) No it was actually cool. Thanks again. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Brian K. White
-
David C. Rankin
-
David C. Rankin, J.D.,P.E.
-
Per Jessen