Wednesday, April 3, 2013

Trailing Slash in rsync command

Just making a quick reference to the rysnc manual in order to synchronize directories

The command used to copy folders is as follows:
 
rsync -avz foo:src/bar /data/tmp
 
This command copies the directory bar in /data/tmp .. 
meaning at the end of this command, you will have /data/tmp/bar folder
 
 
If you just want to sync the folders then use the trailing slash like this
 
rsync -avz foo:src/bar/ /data/tmp 

Now only the contents of bar will be copied into /data/tmp folder;
 you will not find a folder called bar in /data/tmp

No comments:

Post a Comment