Written by James McDonald

June 20, 2008

I’m putting this here so I can recall it for later

find -mtime +2 -type f -print -exec mv {} /home/user/old/ \;

Basically it does the following: Find all files where the File’s data was last modified more than 2 days ago and run the move command on each file to move them to the specified directory.

find -mtime +2 -type f -print -exec rm -f {} \;

This one removes any files older than 2 days from the current directory. Don’t do this in /usr/bin!

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…