Rsync not deleting

Meisam Mulla picture Meisam Mulla · Oct 23, 2011 · Viewed 9.1k times · Source

I have setup rsync to mirror a directory from a source server(a) to a mirror(b). I have gotten it to send new files that are on the source but when I delete a file from the source it doesn't end up deleting it.

Below is what I use to call rsync:

rsync -vhzrplt --stats --delete --rsh='/usr/bin/ssh -q'  --exclude="core/" --exclude="cache/" /home/(a)/public_html (b):/home/(b)/public_html/

When I run rsync i get the output below:

stdin: is not a tty
sending incremental file list
public_html/
deleting public_html/test.html

Number of files: 389
Number of files transferred: 0
Total file size: 3.16M bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 9.25K
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 9.33K
Total bytes received: 47

sent 9.33K bytes  received 47 bytes  1.25K bytes/sec
total size is 3.16M  speedup is 336.81

As you can see it shows that it's deleting test.html but it never ends up doing it. Any help is appreciated.

Answer

Meisam Mulla picture Meisam Mulla · Oct 23, 2011

I was able to fix this by using this instead:

rsync -vhzrplt --stats --delete --rsh='/usr/bin/ssh -q'  --exclude="core/" --exclude="cache/" /home/(a)/public_html/ (b):/home/(b)/public_html/

Add trailing slashes to paths that are folders.