On a related note, in case any are coming in from google etc trying to find while rsync
is not copying hidden subfolders, I found one additional reason why this can happen and figured I'd pay it forward for the next guy running into the same thing: if you are using the -C
option (obviously the --exclude
would do it too but I figure that one's a bit easier to spot).
In my case, I had a script that was copying several folders across computers, including a directory with several git projects and I noticed that the I couldn't run any of the normal git
commands in the copied repos (yes, normally one should use git clone
but this was part of a larger backup that included other things). After looking at the script, I found that it was calling rsync
with 7 or 8 options.
After googling didn't turn up any obvious answers, I started going through the switches one by one. After dropping the -C
option, it worked correctly. In the case of the script, the -C
flag appears to have been added as a mistake, likely because sftp
was originally used and -C
is a compression-related option under that tool.
per man rsync
, the option is described as
--cvs-exclude, -C auto-ignore files in the same way CVS does
Since CVS is an older version control system, and given the man page description, it makes perfect sense that it would behave this way.