Thomas Otto
2003-Nov-10 11:58 UTC
ssh & keep absolute local paths from --include-from=file remotely
Hi! I am trying to do a IMHO rather trivial thing with rsync via ssh: I have some files under /etc and some under /home/thomas, I want to rsync just these to a remote PC with a similar setup where they should end up in the same dirs, and this with a single rsync call. Bascially 'tar --files-from FILE -cf - | netcat' and 'cd /; netcat | tar -xf -' with the optimisation rsync and the security ssh provides. I went up to doing fancy stuff like rsync -av -e ssh --include '*/' --exclude '*' --include-from=file / thomas@10.10.164.170:/ (file containing \n seperated /etc/bash.bashrc /etc/profile /home/thomas/testfile) ..yet no success. rsync ends up either stating all files recursivly so i ^C or it just tries to dump them all into / (where I don't have write access). So all I want is rsyncing files while preserving their _absolute_ paths on the target machine which doesn't seem possible. Can someone point me to a patch or so? If not consider this as a feature request :) TIA -Thomas P.S.: Please no "hacks" like hardlinking the /etc/ files to a subdir and just rsyncing this subtree or a 'for i in `cat Datei` do rsync $i foo@bar:${i%\/*} ... ', since this is via ssh and even with a keyfile the connection would have to be re-established everytime.
jw schultz
2003-Nov-10 12:05 UTC
ssh & keep absolute local paths from --include-from=file remotely
On Mon, Nov 10, 2003 at 01:58:07AM +0100, Thomas Otto wrote:> Hi! > > I am trying to do a IMHO rather trivial thing with rsync via ssh: > > I have some files under /etc and some under /home/thomas, I want to > rsync just these to a remote PC with a similar setup where they should > end up in the same dirs, and this with a single rsync call. Bascially > 'tar --files-from FILE -cf - | netcat' and 'cd /; netcat | tar -xf -' > with the optimisation rsync and the security ssh provides. > > I went up to doing fancy stuff like > > rsync -av -e ssh --include '*/' --exclude '*' --include-from=file / > thomas@10.10.164.170:/ > > (file containing \n seperated /etc/bash.bashrc /etc/profile > /home/thomas/testfile)It would be much simpler to just put all your patterns in the --include-from file. _Read_ the "EXCLUDE PATTERNS" section of the manpage.> > ..yet no success. rsync ends up either stating all files recursivly so i > ^C or it just tries to dump them all into / (where I don't have write > access). > > So all I want is rsyncing files while preserving their _absolute_ paths > on the target machine which doesn't seem possible. Can someone point me > to a patch or so? If not consider this as a feature request :)Doing this is a snap, you just need to understand the implications of the pattern matching. -- ________________________________________________________________ J.W. Schultz Pegasystems Technologies email address: jw@pegasys.ws Remember Cernan and Schmitt
Wayne Davison
2003-Nov-10 18:21 UTC
ssh & keep absolute local paths from --include-from=file remotely
On Mon, Nov 10, 2003 at 01:58:07AM +0100, Thomas Otto wrote:> So all I want is rsyncing files while preserving their _absolute_ paths > on the target machine which doesn't seem possible.Check out the --relative (-R) option in the man page. That would let you do something like this: rsync -avR `cat /path/file-list` dest:/ Or, the CVS version of rsync which has the --files-from option: rsync -av --files-from=/path/file-list / dest:/ (Note that the --files-from option implies --relative.) ..wayne..