-   Linux - Newbie (
-   -   deleting by date a specific range of files (

nooks12 01-08-2008 01:19 PM

deleting by date a specific range of files

I'd like to go further than deleting files after a certain date i.e.

find . -mtime +30 -exec rm {} \;

and have instead a time frame defined for deleting. For example, I have some file from Sept 2006 only that I want to delete and to keep files that are older than that.

Can anyone help me?

Thanks in advance!

forrestt 01-08-2008 02:36 PM

Well, I'm not exactly sure how many days ago Sept 2006 was, but:


find . -mtime [numberOfDays] -exec ls -lad {} \;
Should work if you replace [numberOfDays] with the correct value of the day in question and "ls -lad" with the rm once you have tested.



forrestt 01-08-2008 02:45 PM

I may have misread what you were asking. You can also do something like:


find . -mtime +[numberOfDaysToSept312006] -mtime -[numberOfDaysToSept012006] -exec ls -lad {} \;


All times are GMT -5. The time now is 03:06 AM.