Find and execute

Earlier I posted an article about finding file that are owned by a specific users. But I frequently use the find command in combination with the -exec option.

As a reminder to my self, find file and remove them:

find [PATH] -name “[FILE]” -mtime +[DAYS] -exec rm {} \;

This is very powerfull when you want to clean up old logging.

Or if you want to move / rename several files in a directory just do:

find * -exec mv ‘{}’ blah_’{}’_blah \;

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>