rsync ignores --force and will not delete non-empty directories from destination (HFS+ -> FAT32)

Simon Brown s.brown549 at btinternet.com
Mon Mar 2 15:46:53 GMT 2009


Hi. This is my first post to this list. I have searched the archives but 
cannot find anything that touches on this particular issue.

My scenario: I am trying to rsync from an external HFS+ (USB2) to a 
FAT32 external NAS drive, using rsync version 2.6.9  protocol version 29 
(as supplied with Mac OS X Tiger 10.4.11). The data being synced is MP3 
music files and JPGs.

The command I am issuing within my script is:
       rsync -ruxi "$sourcedir" "$destdir" \
        --size-only --force --log-file="$synclog" --stats --delete 
--modify-window=2 --out-format="%i %n%L (%b)" $* >>"$logfn" 2>&1

The issue is that the sync works almost as expected, but fails to delete 
non-empty directories at the destination that no longer exist at the 
source. Running rsync with -n (dry-run) shows that extraneous 
directories will be deleted, but when I omit -n, only the empty 
directories are listed for deletion (and deleted).

When I run the same command using a destination on one of my HFS+ drives 
it works as expected, but when the destination is FAT32 it will only 
delete empty directories.

Readers may notice that I am not preserving Mac resource forks (-E). 
This is by design as the files I am syncing to not have resource fork 
metadata that I want to preserve (the ._* files actually cause problems 
for Windows software in this scenario, making it list duplicate versions 
of each file).

I am unsure whether I should be using -u, --size-only and 
--modify-window together, though I do not see a connection between those 
options and the failure to delete.

After some Googling I have tried using trailing '/." on the source 
directory path, that some people said improved rsync deletion behaviour, 
but it has not worked in this scenario.

Is this problem solved in newer versions of rsync, and can I safely use 
any of these on my pre-Intel Mac.

Thanks for reading. I've been stuck on this for a few days now so I hope 
someone here can help.


More information about the rsync mailing list