Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Files size older then 10 days

SOLVED
Go to Solution
Advisor

Files size older then 10 days

[ Edited ]

 

Hi All,

 

cpmtest> model
ia64 hp superdome server SD32B

 

I am trying to use a command which can be used to locate files older then n days and also calculate the size of all the files , because I am planning to remove files older then 10 days and at the same time, I need to know, what size I was able to reclaim after deleting those.

 

Also, I would also seeking to find a command , which would list files greater then 5 mb's.

 

Regards

Alok

 

 

P.S. This thread has been moved from HP-UX-General to HP-UX - languages. -HP Forum Moderator

2 REPLIES
Honored Contributor [Founder]

Re: Files size older then 10 days

> Also, I would also seeking to find a command , which would list files greater then 5 mb's.

 

find / -size 5242880c

 

For your other problem, I think you should think of it this way:

  1. create a list of files older than N days, and save it to a file (e.g. find / -type f -mtime +N >/tmp/list-of-files)
  2. loop through the list of filenames, finding the size of each one and calculate the sum of the sizes.
  3. if you want to delete the files, use the same list of files again to delete them (another loop, or maybe using xargs)

 

But would it not be simpler to record the amount of disk space used/available before the deletion and again after the deletion, and calculate the difference of the two?

MK
Advisor

Re: Files size older then 10 days

 

thanks for the inputs.