Click to See Complete Forum and Search --> : Need help with find and mtime


mdkelly
01-08-2004, 03:00 PM
Hi all,

Okay, here is what I am trying to do.

I manage a Linux/Samba file server for the office I work in and I am trying to create a script/command that will find and remove all backup files that have not been modfied or accessed in the last 3 months, about.

I have been experimenting with the "find" command and "mtime" and can locate all the files that have been modified within whatever time frame I choose, but I need the opposite of that, the ones that haven't been.

Just a little stuck
Thanks
mdkelly

jim mcnamara
01-08-2004, 04:08 PM
find /directory -name \*.log -atime +90 -exec rm {} \;


-atime +90 means it has not been accessed for 90 days.

jim mcnamara
01-08-2004, 04:09 PM
And.. -mtime +90 works the same way.

mdkelly
01-08-2004, 04:22 PM
Thanks

I guess when I read the man pages I thought that something like
-mtime/-atime +90 would only show me the files the were modified previously to that date.

Hmmm .....

When I write it like that it makes sense.

Thanks for your input and help

Cheers
mdkelly