Difference in behaviour with --backup

va_public <yahoogroups at vikas.mailshell.com> yahoogroups at vikas.mailshell.com
Sat Mar 1 00:46:05 EST 2003

--- In rsync at yahoogroups.com, Bennett Todd <bet at r...> wrote:
> If this isn't possible, perhaps because you want to have backup-dir
> on the src side, then I think your only alternative may be to
> perform your single-file copy as a recursive copy, using --exclude
> and --include arguments to narrow down the recursive copy so it only
> actually picks up the single file you're interested in. Those args
> are a mite tricky, and I can't say I've got them mastered myself,
> I'll let someone else advise on how to use them to get what you
> want.

This is what I ended up using. I did

dir=$(dirname $file)
filename=$(basename $file)
rsync -a --backup --backup-dir=$dir/Versions --suffix=.$(date +%Y%m%d)
 --include=$filename --exclude=* $dir/ remote:$dir/

Since I am putting the backups in the same dir as the file being 
synced, I dont risk any collisions.

Works like a charm.

Thanks everyone.

More information about the rsync mailing list