Passing a filename via a variable to tar from within PHP?

Johnnnyyy

New Member
I am trying to ultimately extract some files from a tar archive within PHP, however my simple test script is failing at the first part, which was to simply list the files in the archive.Is there any reason why this test script fails?What I see output is:\[code\]> -sh-3.2$ php showfile.php /var/www/vhosts/smartphonesoft.com/httpdocs/fred/epf/itunes20100825.tbz> tar: Old option `f' requires an> argument. Try `tar --help' or `tar> --usage' for more information.\[/code\]My simple PHP script is:\[code\]<?php foreach (glob("/var/www/vhosts/smartphonesoft.com/httpdocs/fred/epf/itunes*.tbz") as $file) { }$path_parts = pathinfo($file);$tarfile = $path_parts['filename'];echo $file . "\n";exec('tar tvf $file',$ret);?>\[/code\]
 
Back
Top