Replacing directories with symbolic links

Hanno Foest hurga at tigress.com
Mon Nov 28 17:14:50 GMT 2005


Hello,

I'm backing up a file server using rsync from a cron job, which recently
started to give me errors like:

delete_file: rmdir "/some/path" failed: Directory not empty
symlink "/some/path" -> "/some/other/path" failed: File exists

Looking at the involved files and directories, it looks like the user
decided to replace a directory with a symlink, but rsync doesn't seem
to delete the directory on the backup machine if that happens.

I tried to reproduce the problem:

server1:~ # mkdir /tmp/test
server1:~ # touch /tmp/test/foo
server1:~ # touch /tmp/test/bar
server1:~ #

backuphost:~ # rsync -avzH server1:/tmp/test .
receiving file list ... done
test/
test/bar
test/foo

sent 70 bytes  received 164 bytes  468.00 bytes/sec
total size is 0  speedup is 0.00
backuphost:~ #

server1:~ # mv /tmp/test /tmp/test2
server1:~ # ln -s /tmp/test2 /tmp/test
server1:~ #

backuphost:~ # rsync -avzH server1:/tmp/test .
receiving file list ... done
rsync: delete_file: rmdir "/root/test" failed: Directory not empty (39)

sent 20 bytes  received 65 bytes  170.00 bytes/sec
total size is 10  speedup is 0.12
rsync error: some files could not be transferred (code 23) at main.c(1173)
backuphost:~ #

I've been using rsync 2.6.6 on both machines. - Is there some option I've
been missing? Any help would be appreciated.

Hanno


More information about the rsync mailing list