Rayn D Rayn D -4 years ago 125
Javascript Question

Extract tar file after copy without success

Im copy tar file form folder A to folder B and I want that when
it finish to copy it to unzip it, I try with the following in my shell script which doesnt work,any idea?

cp /home/i557956/A/file.tar /home/i557956/B
tar -xvf /home/i557956/B/file.tar

The copy was success but the tar is not extracted in B folder...

Answer Source

Try to move into the B folder before extracting:

cp /home/i557956/A/file.tar  /home/i557956/B
(cd /home/i557956/B/ && tar -xvf file.tar)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download