Date: Thu, 28 Mar 2002 08:26:08 -0500 From: "Scott M. Nolde" <scott@smnolde.com> To: Patrick O'Reilly <bsd@perimeter.co.za> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: find | cpio syntax Message-ID: <20020328082608.C39175@smnolde.com> In-Reply-To: <00ed01c1d637$4c5ccca0$b50d030a@PATRICK>; from bsd@perimeter.co.za on Thu, Mar 28, 2002 at 11:02:28AM %2B0200 References: <20020327215404.A39175@smnolde.com> <00ed01c1d637$4c5ccca0$b50d030a@PATRICK>
next in thread | previous in thread | raw e-mail | index | archive | help
Patrick O'Reilly(bsd@perimeter.co.za)@2002.03.28 11:02:28 +0000: > From: "Scott M. Nolde" <scott@smnolde.com> > > > > Greetings, > > > > Can anyone provide the syntax for remotely copying files from a remote > > machine to another using find | cpio | ssh? I'd like to pipe the > output > > over ssh to the local machine and store the file as a gzip or tar.gz > file > > archive. > > > > Can anyone lend a hand? > > > > If you want to keep it as a .tgz, then why not use tar in the first > place (instead of find | cpio) ? > > I did this and it worked fine: > # cd /local/path/to/be/tarred > # tar czf /tmp/1.tgz . > # scp /tmp/1.tgz myuserid@hostname.com:/full/path/to/remote/tarball.tgz > > I did try: > # tar czf - . ; scp - > myuserid@hostname.com:/full/path/to/remote/tarball.tgz > but that did horrible things to my terminal, so don't do it :) > > To create the archive on a remote box, then fetch it back, try this: > # ssh myuserid@hostname.com "tar czf /tmp/1.tgz > /remote/path/to/be/tarred" > # scp myuserid@hostname.com:/tmp/1.tgz /full/path/to/local/tarball.tgz > > You can also do scp between two remote hosts, I believe, but I have > never tried it. > > Regards, > Patrick O'Reilly. Yes, but tar doesn't preserve file ownerships. The idea is to use find to give a pathspec to cpio which will write to stdout which is piped to ssh to a remote machine where the tgzi file is built. If there is limited space on the remote machine I cannot make a tgz of its filesystem. But if i can write everything to stdout which is piped to ssh i can store the compressed file on the local machine which has the space. Any further ideas? -- Scott Nolde GPG Key 0xD869AB48 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020328082608.C39175>