Hi all,
No flames please. This is not as easy as it looks...
The goal: The find all directories which are say over 30 days old and
print them...with a view to alerting users and possibly archiving
them... easy you say....
find . -type d -mtime +30 -prune -exec du -sk {} \\;|sort -nr |
This even nicely gives the size... but it doesn't do exactly what I
want, because there could be sub-dirs that might be very active. If I
leave out the prune I get lots more dirs, but I still don't know if
any one is really valid. I could add a depth option but that doesn't
help because it will still print out invalid dirs, just in a different
order...
The only solutions I see are.... find all dirs younger than 30 and
compare with the older ones and do lots of manipulating...or make
some kind of recusive script to run under -exec in the find command.
Neither very elegant...
Example:
|-->2 (35 days)-->6 (2 days)
1(100days)--->|-->3 (15 days)-->5 (35 days)
|-->4 (40 days)
what should be returned is
/1/4
/1/3/5
and nothing else... but find as outlined will get
/1
/1/2
/1/3/5
/1/4
This should be something lots of people would want to do. Am I missing
someting obvious?
John McDonnell.
Cork, Ireland.