Jump to content

extract tar.gz to folder with certain name?


ChrisMartino

Recommended Posts

It shouldn't be needed, It will cd and create it automatically (GNU tar)

tar -xzvf tarfile.tar.gz -C ../foo

 

The -p parameter maintains permissions, in case the user mask is set which may be want to be left out if != root.

Link to comment
Share on other sites

As far as I know you'll need to create the directory first.

 

mkdir ../foo ; tar xvpf tarfile.tar.gz -C ../foo

 

Thats brilliant, One problem though, Inside the .tar.gz there is a file, THEN the files that i need to be extracted into the folder that we made, Is there any way to just get the contents of the folder 'ivmpsvr' from within the .tar.gz?, Thanks.

Link to comment
Share on other sites

just use

mkdir ../foo ; tar xvpf tarfile.tar.gz ivmpsvr -C ../foo

 

It doesn't extract it now :/

 

$ssh->exec('cd /home/'.$ClientFolder.' && mkdir '.$ServerID.' && cd /home/Games && tar xvpf '.$game.'.tar.gz ivmpsvr -C ../'.$ClientFolder.'/'.$ServerID);

Link to comment
Share on other sites

just use

mkdir ../foo ; tar xvpf tarfile.tar.gz ivmpsvr -C ../foo

 

It doesn't extract it now :/

 

$ssh->exec('cd /home/'.$ClientFolder.' && mkdir '.$ServerID.' && cd /home/Games && tar xvpf '.$game.'.tar.gz ivmpsvr -C ../'.$ClientFolder.'/'.$ServerID);

 

is the ivmpsvr directory in the root of the archive? If not you will need to specify the path to it. You may need to do something like:

$ssh->exec('cd /home/'.$ClientFolder.' && mkdir '.$ServerID.' && cd /home/Games && tar xvpf '.$game.'.tar.gz '.$game.'/ivmpsvr -C ../'.$ClientFolder.'/'.$ServerID);

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.