rsync deleting directories when synchronizing

Wayne Davison wayned at
Thu Oct 20 20:12:21 GMT 2005

On Thu, Oct 20, 2005 at 02:56:42PM -0400, Liam Steacker wrote:
> When we issue the above commands, rsync removes the /etc/init.d
> directory altogether, and recreates it with only the scripts in the
> module, thereby removing all of our existing init scripts.

What probably happened was that /etc/init.d was a symlink (e.g. on Red
Hat /etc/init.d is a symlink to rc.d/init.d).  If this is a directory on
the source system, rsync will remove the symlink and replaced it with
the directory.

You have two solutions:  The best solution is to use the same symlinked
directory structure in your modules as in your destination dirs.
Alternately, you could use the --keep-dirlinks option to tell rsync to
treat a symlink to a directory as if it were an actual directory.


More information about the rsync mailing list