Looking for some help


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Looking for some help
# 8  
Old 06-21-2012
If it wasn't for the time criteria, du -s by itself would do that.

Since you have to break it down to total up only the ones you want, you have to sum it up yourself. That's easy enough.

Code:
find /xx/yy -mtime -1 -type d | xargs du -s | awk '{T+=$1} END { print T, "/xx/yy"}'

This User Gave Thanks to Corona688 For This Post:
# 9  
Old 06-21-2012
xx/yy/zz/x/y/z

It looked right to me but when I ran it the results it gave me were for a total of all of the directories in xx/yy only...while was hoping for a size breakdown of each of the directories "zz".

Not sure if I'm asking the impossible
# 10  
Old 06-21-2012
Code:
for X in xx/yy/*
do
        [ -d "$X" ] && echo "$X"
done | xargs du -s

This User Gave Thanks to Corona688 For This Post:
# 11  
Old 06-21-2012
Did I mention you guys all rock?

Corona688...that code will help me tons doing some analytics at work

If only now there was a way to combine the 2...only measure the directories with a "-ctime -1" or if thats too complex include the ctime of that directory along with the total size in a single line of output.
# 12  
Old 06-21-2012
I'm not sure I understand your intent, but if you want to loop that statement, put it in a loop:
Code:
for X in xx/yy/*
do
        [ -d "$X" ] || continue
        find "$X" -mtime -1 -type d | xargs du -s | awk '{T+=$1} END { print T, "/xx/yy"}'
done

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question