LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   deleting by date a specific range of files (https://www.linuxquestions.org/questions/linux-newbie-8/deleting-by-date-a-specific-range-of-files-612045/)

nooks12 01-08-2008 01:19 PM

deleting by date a specific range of files
 
Hi,

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:

Code:

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.

HTH

Forrest

forrestt 01-08-2008 02:45 PM

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

Code:

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

Forrest


All times are GMT -5. The time now is 04:38 AM.