Files size older then 10 days (285 Views)
Reply
Advisor
Alok_Behria
Posts: 28
Registered: ‎09-14-2011
Message 1 of 3 (285 Views)
Accepted Solution

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

Please use plain text.
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 2 of 3 (273 Views)

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
Please use plain text.
Advisor
Alok_Behria
Posts: 28
Registered: ‎09-14-2011
Message 3 of 3 (263 Views)

Re: Files size older then 10 days

 

thanks for the inputs.

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation