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