11-19-2013 07:25 AM - last edited on 11-19-2013 09:12 PM by Lisa198503
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.
P.S. This thread has been moved from HP-UX-General to HP-UX - languages. -HP Forum Moderator
Solved! Go to Solution.
11-19-2013 09:24 AM
> 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:
- 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)
- loop through the list of filenames, finding the size of each one and calculate the sum of the sizes.
- 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?