ChrisMartino Posted April 25, 2010 Share Posted April 25, 2010 Hey dose anyone know the command i would need to run to extract a .tar.gz file to the directory before the one that it's in with a special name for the folder name that it extracts too?, Thanks, Chris. Quote Link to comment Share on other sites More sharing options...
trq Posted April 26, 2010 Share Posted April 26, 2010 As far as I know you'll need to create the directory first. mkdir ../foo ; tar xvpf tarfile.tar.gz -C ../foo Quote Link to comment Share on other sites More sharing options...
oni-kun Posted April 26, 2010 Share Posted April 26, 2010 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. Quote Link to comment Share on other sites More sharing options...
trq Posted April 26, 2010 Share Posted April 26, 2010 GNU's tar will not create any directory using the -C switch, just change to an existing directory. Quote Link to comment Share on other sites More sharing options...
ChrisMartino Posted April 26, 2010 Author Share Posted April 26, 2010 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. Quote Link to comment Share on other sites More sharing options...
tomfmason Posted April 26, 2010 Share Posted April 26, 2010 just use mkdir ../foo ; tar xvpf tarfile.tar.gz ivmpsvr -C ../foo Quote Link to comment Share on other sites More sharing options...
ChrisMartino Posted April 27, 2010 Author Share Posted April 27, 2010 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); Quote Link to comment Share on other sites More sharing options...
tomfmason Posted April 29, 2010 Share Posted April 29, 2010 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.