Find & copy
February 5, 2009I had a need to get find a few files that had been added or modified within the last 14 days and make a backup of those files.
Not to big of a problem, except that they were hidden amongst 90,000+ other files.
Find to the rescue! The operation comes in two parts.
First I need to create a mirror of the directory structure.
find /exports/ -mtime -14 -type d -exec mkdir -p /root/backup/{} \;
Then we backup the files
find /exports/ -mtime -14 -type f -exec cp -pf '{}' '/root/backup/{}' \;





