Batch mode scenario ("use case")

Matt McCutchen hashproduct+rsync at gmail.com
Tue Sep 11 03:24:44 GMT 2007


On 9/9/07, Suresh Govindachar <sgovindachar at yahoo.com> 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.

Matt


More information about the rsync mailing list