Batch mode scenario ("use case")
Suresh Govindachar
sgovindachar at yahoo.com
Wed Sep 12 04:07:00 GMT 2007
Matt wrote:
>Suresh Govindachar wrote:
>
>> How about the following scheme?
>>
>> open /e/cmds/foo
>> <do till end-of-file>:
>> <begin-continue>
>>
>> discard lines till there is a match to some/path/projects/c_a
>>
>> keep lines till there is a match to a directory outside c_a
>> Note that the lines being kept could be
>> data/commands corresponding to files inside c_a
>>
>> <end-continue>
>> <end-do>
>> write kept lines to new batch file
>
> This is a clever idea, but I think it would be very difficult to
> subset the batch file correctly since the rsync protocol is quite
> complex (and binary). For one thing, the new batch file would
> need to contain the protocol initialization and at least the
> relevant portion of the file list. You might be able to
> accomplish this by keeping everything until the first file
> transfer is logged, but that won't work if the sender used
> incremental recursion because the relevant portion of the file
> list will be randomly interspersed with file transfers.
>
> If you need to restore a subtree from a batch file, another thing
> you could do is make a modified copy of rsync just for the job
> with a strncmp thrown in to skip all file transfers except the
> ones in the subtree. Also, instead of a batch file, you might
> consider copying to a new destination with --compare-dest to the
> original; that gives you a tree of changed files from which you
> can easily restore files or subtrees.
Thanks for pointing out --compare-dest: I verified it on a test
directory and this feature does indeed offer a resolution to the
situation described in the original post.
(I have a follow up question which belongs to another thread.)
--Suresh
More information about the rsync
mailing list