0

I try to synchronize content back to a remote server with the difference that server has a new /home/virtual folder what I don't want to touch:

rsync -avz --numeric-ids --fake-super --delete --delete-after --exclude='/home/virtual' --stats -e "/usr/bin/ssh -i backupkey" /backups/machine1/home/ root@10.0.0.5:/home

Is there a way to tell rsync to do the synchronization, but don't touch that folder? If I take out the --delete key then the other stuff which needs to be deleted won't get deleted so it's not an option. The exclude directive only seems to apply for the source.

Thanks

  • I don't understand the problem? rsync won't remove excluded files, and if you're still afraid that it does, use --no-delete-excluded. Try with --dry-run if you're unsure what will happen. – jornane Jul 29 '14 at 7:36
0

Sadly --exclude applies to the source side, not the destination (as you said). My best recommendation is to move the data you want to keep outside of the destination area. For example, instead of /home/virtual use /keep/virtual

0

I have the same problem and I could understand the --exclude behavior with this, see: https://unix.stackexchange.com/a/83403.
The key detail is that slashes position are important. Quoting from the link:

If you append a slash to the end of the source directory rsync -a source/ destination it will copy the contents of source, otherwise rsync -a source destination copies the source directory itself to the destination.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.