Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Files size older then 10 days

SOLVED
Go to solution
Highlighted
Alok_Behria
Advisor

Files size older then 10 days

 

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
Matti_Kurkela
Honored Contributor

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
Alok_Behria
Advisor
Solution

Re: Files size older then 10 days

 

thanks for the inputs.