Size of files which are older than x days


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Size of files which are older than x days
# 1  
Old 12-06-2011
Size of files which are older than x days

Hi

I want to find the total space used by the files which are older than x days
Code:

find ./ -type f -mtime +x-days -name "G00*" -exec du {} \; | awk '{total+=$1}END{print "TOTAL" total}'

Total prints as 17.20 MB ( total / 1024*2 )


But actual size of it will be around 18.5 GB appx. i have tried with ls -l 5th parameter but no use

How can i determine space used by files which are x days old .
# 2  
Old 12-06-2011
Try:
Code:
find ./ -type f -mtime +x-days -name "G00*" -exec du -k {} \; | awk '{total+=$1}END{print "TOTAL" total/1024}'

This User Gave Thanks to bartus11 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List files older than 10 days.

Hello all, I want to list the files older than 10 days. Currently am using find ./ -mtime +10 -exec ls -ltr {} \; command. But I want to execute the same command in 16 directories at a time and want an output asking to remove those file? Please help me to design the script. regards, Ajay (3 Replies)
Discussion started by: 02Ajay
3 Replies

2. UNIX for Dummies Questions & Answers

Files older than 50 days

Hi All, OS :- HP-UX wm5qa B.11.23 U ia64 1119805695 unlimited-user license I need to search files older than 50 days. I've used following command in order to search desired files, I also discoverd, it's showing today's files as well. Do you have any clue with this ? wmqa1> find .... (4 Replies)
Discussion started by: alok.behria
4 Replies

3. UNIX for Advanced & Expert Users

find files older than 30 days old

Hello, I have a script which finds files in a directory that are older than 30 days and remove them. The problem is that these files are too many and when i run this command: find * -mtime +30 | xargs rm I run this command inside the directory and it returns the error: /usr/bin/find:... (8 Replies)
Discussion started by: omonoiatis9
8 Replies

4. UNIX for Advanced & Expert Users

removing files older than n days

Hi, on AIX 6.1, is there any commande line to remove the files older than n days in a directory ? Thanks. (2 Replies)
Discussion started by: big123456
2 Replies

5. Shell Programming and Scripting

List the files which are older than 7 days

Hi Frnds, I have to list the files which are older than 7 days in the given directory. it should consider only the files and should not show subdirectories. Thanks, Raja (3 Replies)
Discussion started by: smr_rashmy
3 Replies

6. UNIX Desktop Questions & Answers

Find files older than 10 days

What command arguments I can use in unix to list files older than 10 days in my current directory, but I don't want to list the hidden files. find . -type f -mtime +15 -print will work but, it is listing all the hidden files., which I don't want. (4 Replies)
Discussion started by: Pouchie1
4 Replies

7. Solaris

Delete files older than 30 days

Hi all, I want to delete log files with extension .log which are older than 30 days. How to delete those files? Operating system -- Sun solaris 10 Your input is highly appreciated. Thanks in advance. Regards, Williams (2 Replies)
Discussion started by: William1482
2 Replies

8. Solaris

Copying files older then 2 days

Hi everyone :) I have a little question here, at my work, we have a system running Solaris 10 - with an attached EMC SAN, the SAN is running out of space, and we are moveing the data to a new EVA SAN. The problem here is, that there are over 35.000.000 files on the system, and constantly 30... (4 Replies)
Discussion started by: Skovsen
4 Replies

9. Shell Programming and Scripting

Finding cumulative size of files older than certain days

Hi All, I've got a ton of files in a particular directory. I want to find pdf files older than 30 days in that directory and then the cumulative size of those files. Ex: find /home/jk/a -name "*.pdf" -mtime +30 consider it finds the below 4 files. /home/jk/a/1.pdf /home/jk/a/2.pdf... (1 Reply)
Discussion started by: rohan076
1 Replies

10. UNIX for Dummies Questions & Answers

Removing files older than 7 days

Script help, I need to delete files that are older than 7 days. I do that automatically but I know that a cron job can do the job for me. Any help is greatly appreciated, as you can see, I am a DOS or WINDOWS guy. Little on UNIX. Thanks (3 Replies)
Discussion started by: texasoeb
3 Replies
Login or Register to Ask a Question