not finding files within archive using tar.class
Posted: Tue May 30, 2006 11:24 am
All,
I am having a problem when working with tar.class. I found the class here http://www.koders.com/php/fid7E47CBB434 ... 9A0A2.aspx I've attached my code below and the output which I see after. I think that the class is not finding the files contained in the tar archive but I'm not sure why?
Here's what I see afterwards
(notice numFiles is not undefined so we never go into the foreach loop)
TAR Archive Class
Opened /app/dbx/work/test.tar
Files in /app/dbx/work/test.tar
numFiles:
There are no files described in this tar archive.
[/b]
I am having a problem when working with tar.class. I found the class here http://www.koders.com/php/fid7E47CBB434 ... 9A0A2.aspx I've attached my code below and the output which I see after. I think that the class is not finding the files contained in the tar archive but I'm not sure why?
Code: Select all
<?PHP
include('/app/dbx/php/tar.class.php');
$tar = new tar();
$tarfile = "/app/dbx/work/test.tar";
// Open an uncompressed tar file
if(!$tar->openTar($tarfile,FALSE)) {
$message = "Failed to open " . $tarfile;
print $message;
// applog($message);
} else {
$message = "Opened " . $tarfile;
print $message;
// applog($message);
}
// List files in the currently opened tar file(s)
echo "<BR><BR><b>Files in " . $tar->filename . "</b><br>\n";
print "<BR>numFiles: " . $tar->numFiles . "<BR><BR>"; //I added this to print out numFiles
if($tar->numFiles > 0) {
foreach($tar->files as $id => $information) {
echo " $information[directory]/$information[name]<br>\n";
}
} else {
echo " There are no files described in this tar archive.<br>\n";
}
echo "<br>\n";
?>Here's what I see afterwards
(notice numFiles is not undefined so we never go into the foreach loop)
TAR Archive Class
Opened /app/dbx/work/test.tar
Files in /app/dbx/work/test.tar
numFiles:
There are no files described in this tar archive.
[/b]