rsync not deleting Folders in destination

I know there are some questings with the same topic here but no answers helped me.

First, this is my script. It should copy all files from the source to the destination (preserving all rights, etc). If a file or directory is deleted in the source it should also be deleted in the target. Which is not correctly working.

#!/bin/bash
## Basic RSync Command
RCMD="rsync -rulpEXogtzh --stats --delete --force"
DDIR="/tank/bak/s1/archive/"
SDIR="/tank/bak/s1/backup/"
CDAY=`date '+%u'`

echo "Archive Number: ${CDAY}"
echo "Archiving current backup"
$RCMD $SDIR $DDIR/$CDAY

If I have the following directories in the source:

/etc
/home
/root
/usr

and sync them I have the following directories in the target:

/etc
/home
/root
/usr

so this works fine. Now when I delete /usr from the source, my source looks like this:

/etc
/home
/root

but when I run the script again my target still looks like this:

/etc
/home
/root
/usr

so somehow rsync ignores the --delete

rsync Outputs this:

Number of files: 1983645
Number of files transferred: 0
Total file size: 17.69G bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 42.68M
File list generation time: 0.083 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 42.68M
Total bytes received: 4.70K

sent 42.68M bytes  received 4.70K bytes  155.52K bytes/sec
total size is 17.69G  speedup is 414.50

Has anyone an idea why?

Thanks for any answer!


The directory won't be deleted if permissions forbid it, or if the directory is not empty. Often there are files that can't be deleted because they are immutable or otherwise protected. What does ls -a /usr show on the destination?

You might want to try the --force-delete flag, but first run it with -n (dry run mode) to see what it would delete.


In my case, with rsync 3.1.2, the --force or --force --delete options still did not remove directories at the destination folder.

The --delete-excluded option however did actually delete folders.