Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time stamp check script.

Status
Not open for further replies.

ranjank

IS-IT--Management
May 9, 2003
176
IN
Hi,

I want to write a acript where it will check for the latest time stamp and then rysnc it to the remote site.Any pinters on this will be highly appreciated.

Regards,
Ranjan.
 
I want to rsync the files which gets generated every day to a remote destination.I want to write a script which will check the time stamp of the files and will rsync the latest one.

--Ranjan.
 
Why not just rsync all of them every day, since rsync will only copy the latest one (presuming that is the only one that has changed)?

Annihilannic.
 
Well i have the disk space constraint.so i'm planning only to copy the latest one.

--Ranjan.
 
Hmm... rsync is designed to keep two sets of files synchronised, so ideally you should have the same amount of space on both the source and destination. If you are just copying specific files I would use scp.

Anyway, one thing you could do is find /source/dir -type f -mtime -1 | while read f ; do rsync $f destinationhost:/destdir or something along those lines to only transfer files updated in the last 24 hours.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top