Copy Just the Last Two Days of Files to Another Directory

From HowToGeek

Jump to: navigation, search

If you've ever wanted to copy only the files from the last day or two, you can use the find command combined with the -exec argument to copy the files somewhere else.

You'll need to use the -mtime command to find files that are less than 2 days old, and use the cp command with the following syntax:

find /var/backups/files/* -mtime -2 -exec cp '{}' /var/backups/remote/ \;