[CentOS] Copying files from specific date.

Rajeev R. Veedu rajeev at cracknell.com
Mon Jun 9 16:21:59 UTC 2008


-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Steve Huff
Sent: Monday, June 09, 2008 7:34 PM
To: centos at centos.org
Subject: Re: [CentOS] Copying files from specific date.


On Jun 9, 2008, at 11:16 AM, Rajeev R. Veedu wrote:
> Does anyone aware of any utility  to copy files which are created  
> or modify form a specific date ?.
>

>>to copy all files in /dir1 modified within the last 5 days to /dir2:

>>$ find /dir1 -mtime -5 | xargs -I {} cp {} /dir2

>>if the filenames have whitespace in them, you can use this trick:

>>$ find /dir1 -mtime -5 -print0 | xargs -0 -I {} cp {} /dir2

>>for more details on selecting by time:

>>$ man find

>>pay particular attention to the options -atime, -amin, -ctime, -cmin,  
>>-mtime, -mmin, and -daystart.

>>-steve
--

Actually I need to copy this on to another server with same folder structure. I think I need to explain bit of history.

I had a server crash last week, and we have restored the files from the tape. However during this period of making the server up, the users having adding or changed files from our backup Server (Samba server which rsync to production server every night.) now I need to copy the files which user added/ modify last 7 days. Ideally if I can get this option in rsync it would be better. Otherwise I need to have a method so that all changed files to go on the relevant folder on the production server. I cannot take the full files in the backup files since they are historical backup and there are some unwanted files. 

Can I use scp instead of cp in your statement?. But how does it take the same directory name as the original location?

Eg:from ServerA/FLDR2/FLDR3/Filename should go to ServerB/FLDR2/FLDR3/FILENAME

Only change is the server name all other values will remain same.

Any help would be really appreciated.

Thanks

Rajeev






More information about the CentOS mailing list