There's no program I'm aware of that can take the tar file and autoextract on the remote machine as a single step. Possible workarounds:
Copy file and extract on remote machine:
[A]% ssh user@B "cd /target && tar xf -" < aaa.tar
Extract file locally and copy:
[A]% mkdir tmp; cd tmp ; tar xf ../aaa.tar ; scp -rp . user@B:/target ; cd .. ; rm -rf tmp
> I've created a taball 'on the fly' never had a reason
> to do the reverse
>
> put "| tar cf - ." filename.tar
>
> no reason why you can't put "| tar xvf-. "
> filename.tar or some other variant.
Yes there's a big reason. Unlike 'tar c', 'tar x' writes to a filesystem, not to stdout or a single file (because it's potentially creating several files). You can't just pipe the output into ftp or anything else. The ftp/scp at the other end has to create all those files, and this method won't do it.
--
Darren
> > Extract file locally and copy:
> > [A]% mkdir tmp; cd tmp ; tar xf ../aaa.tar ;
> > scp -rp . user@B:/target ; cd .. ; rm -rf tmp
> >
> Will this extract the file locally and copy to a
> remote site as and when is getting extracted?
I'm afraid I can't understand the question.
If you're asking about timestamps, then it'll try to preserve them, but you might want to stick a 'p' on the tar options.
--
Darren
There are two solutions for your situation.
Untar the file locally to an empty directory and then have a script read the names of the files that were extracted and feed them to scp to complete the transfers.
Option two. Scp the tar file to the other machine. On the other machine setup a cron entry to untar the file and then move the files to their final destination.
alan
> Example: aaa.tar in machine A shuld get copied to
> machine B as just aaa(means the untar'd content)
>
> is it possible, if yes how?
Why do I get the feeling you're trying to make us do your homework? Probably because I've seen some other threads dealing with the same issue but using other tools (ufsdump comes to mind).
Anyway, since others presented working solutions already I guess I might as well join in.
ssh <machineA> "cat aaa.tar" | tar xvf -
is IMO the easiest and cleanest method to do this. Do make sure you're in the right directory.