--delete-before doesn't seem to actually be deleting before transfer

Tim Edwards tkedwards at fastmail.com.au
Mon Jul 20 15:24:01 MDT 2009

Matt McCutchen schrieb:
> No, rsync will only do that if if you have it
> "synchronize" /USBstick/backups/dir , i.e., specify a source directory
> that maps to it.  Just copying several dirs _into_ /USBstick/backups/dir
> does not do the trick.  See the description of --delete in the man page.
> Something like the following, copying the entire /local/backups/dir but
> excluding all the backups except those you want, would work:
> rsync -av --delete-before --include=/backup1_todaysdate
> --include=/backup2_todaysdate --include=/backup3_todaysdate
> --exclude='/*' /local/backups/dir/ /USBstick/backups/dir
Thanks for the help but I've still had no luck with this. The command 
now looks like:
backupstoremove.py | rsync -av --progress --no-p --no-g --delete-before 
--stats --include-from=- --include=/media/300GIGHD/backups/dar/restore 
--exclude="*.dar" /media/300GIGHD/backups/dar/ 

backupstoremove.py (despite the name) just prints out a list of backup 
files to be transferred (one per line in the format liked by 
--include-from). The includes and excludes are all filtering correctly 
it's just that no matter what combination I try of having the / on the 
end of the source and destination directories I can't get it to actually 
delete before transferring. Instead it tries to transfer straight away 
and ends up hitting against the 'no space left on device'.

I think I'll revert to using my backupstoremove.py script's original 
functionality of just rm'ing the backups from the USB stick before I 
transfer, I really can't work out how --delete-before can possibly be 
made to function in this situation.


More information about the rsync mailing list