Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I need a script on how to get disk usage of files that was added into a dir from Jan 1, 2004, and disk usage per month. Can someone help please.....!
camin

Hi,
I have started this but need some assistance...grateful for any help...thanks.Here is what I need to get..
1. Find all files that have been added to (some dir) since Jan 5/2004
2. Find total number of files which have been added since Jan 5/2004
3. Find total number of diskspace occupied by those files
4. Find total number of directories that contain files. Some directories maybe empty.Here is what I did:
# Find all files with the date of Jan 01/2004
touch -t 200312312359.59 $workdir/Dec31
find $home/allbinaries -type f -newer $workdir/Dec31 >file2.txt# Find total number of files
totalfiles=`wc -l $workdir/file2.txt`
echo "Total number of files $totalfiles" >$workdir/results.txt# Find total number of diskspace occupied by those files
totaldsksp=`du -sk $workdir/file1.txt`
echo "Total diskusage of new files from Jan 1, 2004 $totaldsksp" >>$workdir/results.txt# Find total number of directories that contain files
cat $workdir/file1.txt | while read record;
do
if test -d $record && test -d != ""
then
I am stuck here I do not know if this would be the way of finding total number directories that contain files? there are about 14,000 directories some with files and some without....any help on this would be great...I am not sure if my commands are right so far....
thanks
camin

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |