MacOS – Rsync: Only preserve meta (time, group, etc) on files and sub-directories, not root directory


I am copying some files (all except hidden ones) using rsync from one place to another using this command:

rsync -Cav --delete --exclude=.* /Some/Directory/ other-host:/Other/Directory

It works nice except that I get the following errors:

rsync: chgrp "/Other/Directory/." failed: Operation not permitted (1)
rsync: failed to set times on "/Other/Directory/.": Permission denied (13)

That is understandable because I do in fact not have those permissions, and I also do not want to change the group of that directory. I only want to do this for all the files and directories that are in that directory. Is there any way to solve this? Tried to --exclude=. and --exclude=./, but those didn't work.

Any ideas? I have no idea how to fix this…

More details: This is on Mac OS X, and the directories I am syncing is from a local mounted volume to the /Users/Shared/ directory on the other host. That directory has user root and group wheel. The files inside it has user admin and group staff and so does the local source directory.

Temporar solution: Still curious how I can solve this, but since I don't know how to do that yet, I "solved" this by using a different directory than /Users/Shared for those files.

Best Answer

If you know that other-host:/Other/Directory already exists you could try:

rsync -Cav --delete --exclude=.* /Some/Directory/* other-host:/Other/Directory/

then it shouldn't try to do anything with the root directory other than create files/dirs in it.