On Tue, 2009-07-14 at 13:01 +0200, Tim Edwards wrote: > I have a script transferring some backup files onto a USB stick, which > has limited space. I use rsync 3.0.5 with the following command: > rsync -av --delete-before /local/backups/dir/backup1_todaysdate > /local/backups/dir/backup2_todaysdate > /local/backups/dir/backup3_todaysdate /USBstick/backups/dir > > The USB stick runs out of space if more than 1 backup set is put on it, > so I'd assumed that by using the --delete-before option would first > scrub /USBstick/backups/dir of any files that I hadn't listed to be > transfered - is this how it works?
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 -- Matt -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html