--files-from= and --delete corrent options

j at mesrobertson.com j at mesrobertson.com
Mon Sep 22 05:43:40 GMT 2008


Hi,

I am running the following command to backup a specific file from
/tmp/BACKUPFILE which contains the name "Friday2008-09-19.bkf".

rsync -ah --delete --numeric-ids --stats --delete-excluded
--files-from=/tmp/BACKUPFILE /var/data/shares/vmbackups/
/mnt/usb_backup/SFSYDVS01/daily.0/VM/

The name in /tmp/BACKUPFILE changes each day for example when next run it
will be "Monday2008-09-19.bkf" I use a script before running rsync to
obtain the most recently modified file from /var/data/shares/vmbackups/ and
cat it into /tmp/BACKUPFILE.

I want the /mnt/usb_backup/SFSYDVS01/daily.0/VM/ directory to only ever
contain the most recent backup file e.g.

root at sfnas01:~# ls -t1 /var/data/shares/vmbackups | head -n 1 >
/tmp/BACKUPFILE
root at sfnas01:~# rsync [CORRECT OPTIONS] --files-from=/tmp/BACKUPFILE
/var/data/shares/vmbackups/ /mnt/usb_backup/SFSYDVS01/daily.0/VM/
root at sfnas01:~# ls /mnt/usb_backup/SFSYDVS01/daily.0/VM/
Friday2008-09-19.bkf

Skip to next day.....

root at sfnas01:~# ls -t1 /var/data/shares/vmbackups | head -n 1 >
/tmp/BACKUPFILE
root at sfnas01:~# rsync [CORRECT OPTIONS] --files-from=/tmp/BACKUPFILE
/var/data/shares/vmbackups/ /mnt/usb_backup/SFSYDVS01/daily.0/VM/
root at sfnas01:~# ls /mnt/usb_backup/SFSYDVS01/daily.0/VM/
Monday2008-09-19.bkf

But currently the command grabs everything in /var/data/shares/vmbackups/
and so I end up with:

root at sfnas01:~# ls /mnt/usb_backup/SFSYDVS01/daily.0/VM/
Monday2008-09-19.bkf Friday2008-09-19.bkf

I expected the --delete option would have removed Friday2008-09-19.bkf in
this example (with the --delete option) but it doesn't.  I've read the man
page and googled a bit but I think i'm getting a bit lost.

Sorry if this seems long winded but I hope you understand what I'm trying
to do.

Thanks

James







More information about the rsync mailing list