An rsync command that looks like of like this, rsync -av -e "ssh" --include="dir1" --include="dir2" --include="dir3" --include="file1" --include="file2" --include="file3" --exclude="*" user@server:/directory1/site/ /dir1, is not recursively copying the files. In other words, only the files and non-regular files in the /directory1/site directory are being copied and not the files in it's folders.


The rsync includes/excludes are weird. I strongly suggest you take some time and carefully read the INCLUDE/EXCLUDE PATTERN RULES section of the man page. Pay close attention to all the rules since some things simply won't work in what might seem like the obvious way.

a trailing "dir_name/***" will match both the directory (as if 
"dir_name/" had been specified) and everything in the directory 
(as if "dir_name/**" had been specified). This behavior was added
in version 2.6.7.

So if you wanted the entire contents of a directory you would use --include="dir3/***" instead of --include="dir3".

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.