Reputation: 6144
I am trying to sync two folders
/developer
and /shared
( in ubuntu )
when I modify a file in /shared
, I would like to be able to copy the file to the /developer
folder
I tried
rsync -r /shared /developer
But it seems to copy everything, although I changed only two files there.
How to copy only the changed files.
I also tried
rsync -rtu /shared /developer
somehow I can't get my head around this.
Please help.
Upvotes: 8
Views: 19579
Reputation: 1
Well , this also works
rsync -au --delete --update /shared/ /developer/
Upvotes: -1
Reputation: 25559
Try this:
rsync -a /shared/ /developer/
The first time you run that it will update the access times etc. for every file, but subsequent runs will only copy what's updated.
-a
means "archive". It implies -r
, but also -t
which is what you're missing.cp
does. This means it behaves differently when the destination already does or does not exist.Edit: if you expect it to remove files that no longer exist in /shared
then add --delete
, and use it carefully.
Upvotes: 13