I run a program which generates a list of pathnames of files I need to
install/update from my current directory to an identically arranged
filesystem on a remote machine.  I have a question about using rsync to
do the transfer.  Say the list of files is in a file named ToTransfer
which looks like this:

file1
dir1/file2
dir1/dir2/file3
..

To do the update I can use

rsync --archive --relative file1 `cat ToTransfer` remhost:remdir

Here remhost is the remote host, and remdir is the directory on the
remote host I want to install/update too, and, of course, `cat
ToTransfer` uses the shell to list the pathnames on the command line.

This, however will fail for a long list of files because of limitations
on the length of the command line for the shell. So it would be very
nice if I could just feed rsync the name of the file ToTransfer
and not have to cat its contents onto the command line.

A first attempt would be

  rsync --archive --relative --include-from=ToTransfer --exclude='*' . remhost:remdir

But of course this fails because rsync excludes dir1 before getting to
dir1/file2.  So first I have to extend ToTransfer to contain the names
of all parent (and grandparent...) directories:

file1
dir1
dir1/file2
dir1/dir2
dir1/dir2/file3
..

My question is, is there any easier way that doesn't require this step?

Reply via email to