Delete Files Newer Than

by damonp on September 29, 2005

in Snippets

Delete a files newer than filename in the local directory

find ./ -type f -newer filename -print|xargs rm

Delete a files older (ie. not newer) than filename in the local directory

find ./ -type f ! -newer filename -print|xargs rm

Popularity: 1%

Most Popular Posts

Damon Parker is a freelance sysadmin and web developer in Texas. He specializes in server setup, server security and high performance server configurations. Need help setting up a web server or getting a server back online after a crash or hack? Email Damon

{ 1 comment… read it below or add one }

Robin Bowes April 6, 2011 at 8:49 am

One major gotcha with that method: if filename is in the search path, it will be deleted.

Reply

Leave a Comment

Previous post:

Next post: