Using find and mtime to copy files

syntax

Executive Member
Joined
May 16, 2008
Messages
9,523
Reaction score
1,643
Location
jozi
cant believe i cant get this right, but anyways,

the string is this

find /example/* -mtime +90 -exec cp /var/scratch/ {} \;

basically i want to copy all files older than 90 days to /var/scratch

I suppose i could tar them first, then copy that .tar to the location, but the files are all already tar archives, and i now wanna do it this way..

any ideas?
 
i am tired..
correct way was
find /tests/* -mtime +480 -exec cp {} /var/scratch/ \;

*sigh*
 
fail...it doesnt copy the correct dated files...

/worked find /tests/* -mtime +480 -exec cp -vp {} /var/scratch/ \;

1 man thread
 
You realise that -mtime +90 will give you files that hadn't been modified for 1+90 days?

You also don't need the /* - it will find in every directory found in /example/ instead of just in example.

find /example -mtime +90 -exec cp -v {} /var/scratch/ \;
 
Top
Sign up to the MyBroadband newsletter
X