Urgent....untar!!!

HI UNIX GURUS...
I am facing the a similar problem which malaymaru has posted earlier raegarding untaring a file in some other specified directory.But the solution by UNIX DAEMON "Perderabo" seems little difficult to understand.(USING #pax -r -s '=^/opt/abc=/tmp=' < tarfile)

So plz explain it.........i know this question has been posted earlier.But the number of replies is very less and little difficult to understand.So plz help.

The exact problem statement as follows:--

Suppose a directory is there in /abc/def/source_directory.
Now i make a tar of this directory as source_directory.tar and am successfully able to
ftp it to another server in the path ghi/jkl/source_directory.tar
Now how do i untar the source_directory.tar in the path ghi/jkl only.Now when i try to
untar it from my script using rexec command.the it is being untared to the HOME DIRECTORY
which i believe is happening due to conflict of path when untar is happening....
sample code i m using in my script to untar at the destination server once i m successfully able to ftp the filename.tar.gz file:
rexec azx.corp.asd.com gunzip $2/"$filename".tar.gz
rexec qwe.corp.fgt.com tar -xvf $2/"$filename".tar
plz post the exact solution...

Thanx,
rhaul26 :confused:

I'm a bit confused by the two different machine names:

Can you clarify exactly what the full series of steps is.

cheers

Actually the series of step is as follows:--

i)I m successfully able to ftp a .tar.gz file to a remote location.

ii)Question is how i untar it from script in host only.
I tried using rexec command.
rexec idm.adf.com(name of remote location) gunzip abc/def/something.tar.gz
So after this commad is executed,the .tar file is formed as abc/def/something.tar

But now when i try to unzip it there bu using
rexec idm.adf.com(name of remote location) tar -xvf abc/def/something.tar
The tar file is being formed at the home directory instead of the specifeid path.

Hope it helps.............Plz reply.........very few replies till date.......

Thanx
rahul26

since you have acces to both machines, why not do it the simplest way?

what creating the tar file, go to the directory you want to tar and make a relative path archinve, then when you untar it it will extract in the CWD.

Hi...
But one if one wants to do the same for 40 Application servers.

regards,
Rahul