On Wed, 2008-09-24 at 15:41 +1000, James Robertson wrote: > >> [EMAIL PROTECTED]:~# rsync -ah --delete --numeric-ids --stats > >> --delete-excluded -include-from=/tmp/BACKUPFILE --exclude='*' > >> /tmp/source/ /tmp/destination/
> If /tmp/BACKUPFILE contained a directory e.g. > > [EMAIL PROTECTED]:~# cat /tmp/BACKUPFILE > 3/ > > How would I get it to copy everything under and including > /var/data/shares/vmbackups/3/? and delete everything else on the > destination? The exclude just needs to be anchored so that it matches only the undesired top-level directories, not files inside the desired top-level directory /var/data/shares/vmbackups/3: rsync -ah --delete --numeric-ids --stats --delete-excluded --include-from=/tmp/BACKUPFILE --exclude='/*' /var/data/shares/vmbackups/ DEST/ The --include-from pattern will match any descendants of /var/data/shares/vmbackups/3 that also happen to be directories named 3, but that should not hurt anything. If you feel like being meticulous, you could anchor that one too: ls -t1 /var/data/shares/vmbackups/ | head -n 1 | sed 's,^,/,' >/tmp/BACKUPFILE 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