In Linux command prompt, you can use the
Say for example, you have a directory to keep daily image backup files that stick to a naming convention as IB-mmddyy.
1) To check the total file size of files created in May 2009:

The option switch
2) To check total file size of files in each month of year 2009, you can manually execute the du sample command at above for each month, one by one:
Or, write a simple shell script to automatically execute a series of du -sh command:


du command with appropriate option switch to easily display a summary of total file size for selected files, in addition to printing individual file’s size.Say for example, you have a directory to keep daily image backup files that stick to a naming convention as IB-mmddyy.
1) To check the total file size of files created in May 2009:
du -ch IB-05??09 | grep total

The option switch
-c and -h (or combined as -ch) instruct du to print a grand total of file size (-c option switch) in a human readable format (-h option switch).2) To check total file size of files in each month of year 2009, you can manually execute the du sample command at above for each month, one by one:
du -ch IB-01??09 | grep total du -ch IB-02??09 | grep total . . .
Or, write a simple shell script to automatically execute a series of du -sh command:
#!/bin/sh declare -i i=1 declare j='' until [ $i -gt 12 ] do [ `echo $i | wc -c` -eq 2 ] && j='0'$i || j=$i echo Mth $j : `du -ch IB-$j??09 | grep total` let i++ done


Custom Search



2013 •