rsync not synchronizing .htaccess file rsync not synchronizing .htaccess file shell shell

rsync not synchronizing .htaccess file


This is due to the fact that * is by default expanded to all files in the current working directory except the files whose name starts with a dot. Thus, rsync never receives these files as arguments.

You can pass . denoting current working directory to rsync:

rsync -av . server2::sharename/B

This way rsync will look for files to transfer in the current working directory as opposed to looking for them in what * expands to.

Alternatively, you can use the following command to make * expand to all files including those which start with a dot:

shopt -s dotglob

See also shopt manpage.


For anyone who's just trying to sync directories between servers (including all hidden files) -- e.g., syncing somedirA on source-server to somedirB on a destination server -- try this:

rsync -avz -e ssh --progress user@source-server:/somedirA/ somedirB/

Note the slashes at the end of both paths. Any other syntax may lead to unexpected results!


Also, for me its easiest to perform rsync commands from the destination server, because it's easier to make sure I've got proper write access (i.e., I might need to add sudo to the command above).

Probably goes without saying, but obviously your remote user also needs read access to somedirA on your source server. :)


I had the same issue.

For me when I did the following command the hidden files did not get rsync'ed

rsync -av /home/user1 server02:/home/user1

But when I added the slashes at the end of the paths, the hidden files were rsync'ed.

rsync -av /home/user1/ server02:/home/user1/

Note the slashes at the end of the paths, as Brian Lacy said the slashes are the key. I don't have the reputation to comment on his post or I would have done that.