linux - perl untar single file -


so running issue code here not sure i'm doing wrong pass 2 arguments searches file going not exist.

i pass file

perl restore.cgi users_old_52715.tar.gz ace_walker 

its not finding file exist assure you.

#!/usr/bin/perl use archive::tar;  $tarpath    = $argv[0]; $playerfile = $argv[1].".ini";    $tar = archive::tar->new($tarpath); if ($tar->contains_file($playerfile)) {     $tar->read($tarpath);     $tar->extract_file($playerfile, './' );     print "successfully restored $playerfile production enviroment\n";     exit 0; }else{     print $playefile." not exist in archive!\n";     exit 0; } 

just writing scott hunter's comment answer:

try using absolute path instead of relative one.


Comments