rsync refusing to delete non empty directories

Red Squirrel

No Lifer
May 24, 2003
69,824
13,398
126
www.anyf.ca
This started recently, I don't get it as this script is the same as any other script I use, but this one is the only one affected.

Basically if a folder in the source gets deleted, when the backup runs, it refuses to delete it from the destination despite the --delete or --delete-after or --delete-during flag (tried all 3).

I get the errors like this:


cannot delete non-empty directory: scripts/_custom/mobiles/events/valentinesday
cannot delete non-empty directory: scripts/_custom/mobiles/events/valentinesday
cannot delete non-empty directory: scripts/_custom/mobiles/events/thanksgiving
cannot delete non-empty directory: scripts/_custom/mobiles/events/thanksgiving
cannot delete non-empty directory: scripts/_custom/mobiles/events/misc
cannot delete non-empty directory: scripts/_custom/mobiles/events/misc
cannot delete non-empty directory: scripts/_custom/mobiles/events/christmas
cannot delete non-empty directory: scripts/_custom/mobiles/events/christmas
cannot delete non-empty directory: scripts/_custom/mobiles/events/Halloween Event/Halloween Items/Boss Rewards
cannot delete non-empty directory: scripts/_custom/mobiles/events/Halloween Event/Halloween Items/Boss Rewards
cannot delete non-empty directory: scripts/_custom/mobiles/events/Halloween Event/Halloween Items
cannot delete non-empty directory: scripts/_custom/mobiles/events/Halloween Event/Halloween Items
cannot delete non-empty directory: scripts/_custom/mobiles/events/Halloween Event
cannot delete non-empty directory: scripts/_custom/mobiles/events/Halloween Event
cannot delete non-empty directory: scripts/_custom/mobiles/events/Easter
cannot delete non-empty directory: scripts/_custom/mobiles/events/Easter
cannot delete non-empty directory: scripts/_custom/mobiles/events




The backup script looks like this:


sourcepath="/raid1/applications/remote/ravagerapplications/RunUO/aovalor_test/"

datefile=`date +%a`
pathname="/raid1/backups/servers/ravager/${datefile}_daily/"


mkdir -p ${pathname} > /dev/null
#mkdir -p ${pathname2} > /dev/null


#backup start
echo starting backup from ${sourcepath} to ${pathname}

rsync -rbuv --delete-during ${sourcepath}backups ${pathname}
rsync -rbuv --delete-during ${sourcepath}data ${pathname}
rsync -rbuv --delete-during ${sourcepath}scripts ${pathname}
rsync -rbuv --delete-during ${sourcepath}runuo_core ${pathname}

date > ${pathname}date.txt


The source folder is mounted via a mount.cifs mount. The destination is on a raid5 drive. This is run as root.


 

NoShangriLa

Golden Member
Sep 3, 2006
1,652
0
0

man rsync

then scroll down and read option --force below

--force
This option tells rsync to delete a non-empty directory when it
is to be replaced by a non-directory. This is only relevant if
deletions are not active (see --delete for details).

Note for older rsync versions: --force used to still be required
when using --delete-after, and it used to be non-functional
unless the --recursive option was also enabled.


Please UTSL
 

Red Squirrel

No Lifer
May 24, 2003
69,824
13,398
126
www.anyf.ca
from my google searching --force was not working to fix this problem but I should have tried it anyway.

Just tried it but still wont let me. I have a feeling its something to do with the source being a mount.cifs share. If I manually delete it with rm -rf it works fine.
 

Red Squirrel

No Lifer
May 24, 2003
69,824
13,398
126
www.anyf.ca
weird now it seems most of my other backup jobs are starting to come out with these errors. This really blows. I'll have to write a program that compares both sides and deletes files that don't exist in the source.
 

xSauronx

Lifer
Jul 14, 2000
19,582
4
81
Originally posted by: RedSquirrel
weird now it seems most of my other backup jobs are starting to come out with these errors. This really blows. I'll have to write a program that compares both sides and deletes files that don't exist in the source.

look into unison, it *might* do what you want. i use it to sync my flash drive and ~/ back and forth. as long as permissions on both are set properly it works great
 

Red Squirrel

No Lifer
May 24, 2003
69,824
13,398
126
www.anyf.ca
Read up on it, sounds neat, though I'm really hoping to find a way around this rsync issues as rsync is more standard and enabled by default on most servers. Is there maybe a flag I can set to force delete? (other then --force)