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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rsync help

Status
Not open for further replies.

neonep

Programmer
Jun 26, 2003
34
Is there a way to tell rsync not to download a file if it already exists in the local file system? Here's the command that I use.

/usr/bin/rsync -Huzr --include=*.txt --exclude=* user@server::MODULE/myfiles/ .

I am using rsync version 2.6.2. I thought that the "u" option makes it so that it doesn't download if the file already exists but it's not working. Every time I run this command, it deletes my files on my local drive and re-transfers them from the server.

Any help will be greatly appreciated.


 
u" skips files if the receiver is NEWER!

typically for pure synch of sender to receiver the "a" parameter is sufficient. this includes deletes being replicated.

D.E.R. Management - IT Project Management Consulting
 
Actually that didn't work. It still deletes the file and recreates it every time I run rsync. Does it have to do with the rsync version installed? Please let me know.
 
I should add that right after the rsync, my script changes the permissions on the files. Is that the reason why rsync thinks that it's a new file? Is there a way to fix that?
 
Let's try this another way...

Let's assume that you want to sync from source to target.
Let's assume that you want to preserve timestamp, user, group and permissions.
Let's assume that you want to replicate files, including deletions...


rsync -ta /source/* /target

will work... some variations needed to support ssh between the hosts, etc...

If you have another set of needs, then you may need to document them for further discussion here.

D.E.R. Management - IT Project Management Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top