I'm putting this here so I can recall it for later
The following snippet finds 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.
1 | find -mtime +2 - type f -print - exec mv {} /home/user/old/ \; |
This one removes any files older than 2 days from the current directory. Don't do this in /usr/bin!
1 | find -mtime +2 - type f -print - exec rm -f {} \; |
This one lists all files modified in the last day in the current directory and below
1 | find -mtime -1 - type f |
0 Comments