Jump to content

Delete files older than a specific date and Time

From TetraWiki
Revision as of 03:23, 12 June 2014 by Biswajit (talk | contribs)

Suppose you want to delete files before 10 June 2014 , 09:50 AM

touch -t 201406100950 /tmp/timeref

Then , In the Specific Directory , where mails to be deleted

find . ! -newer /tmp/timeref -exec rm {} \;

This Command will delete all mail which are older than 10 June 2014 , 09:50 AM

Caution: Please Be aware of the Time Zone of The Server before deleting


Referance: http://www.tech-recipes.com/rx/441/delete-solaris-files-older-than-a-certain-date-and-time/

http://www.tech-recipes.com/rx/440/createmodify-a-unix-file-with-an-arbitrary-timestamp/