foxhunt99
March 25th, 2008, 12:09 PM
Hi,
I am trying to use the Pear File_Archive package to manupilate some zip files. I want to write a loop and keep adding files to a zip file until the loop is done.
I did the following code inside the while loop:
$src = File_Archive::read($patchtofile1);
$dest=File_Archive::toArchive("./data.zip", File_Archive::toFiles());
File_Archive::extract($src, $dest);
This doesn't work because data.zip is replaced in every loop. Anyone know the correct way of doing this?
Also I tried to zip a whole directory. I tested by creating a directory which contains 1.txt and 2.txt files. and used code:
$source=File_Archive::read("./tempfolder/");
$dest=File_Archive::toArchive("./data.zip", File_Archive::toFiles());
File_Archive::extract($source, $dest);
This created a data.zip file, but it contains three copies of 2.txt files for some reason.
Thanks
I am trying to use the Pear File_Archive package to manupilate some zip files. I want to write a loop and keep adding files to a zip file until the loop is done.
I did the following code inside the while loop:
$src = File_Archive::read($patchtofile1);
$dest=File_Archive::toArchive("./data.zip", File_Archive::toFiles());
File_Archive::extract($src, $dest);
This doesn't work because data.zip is replaced in every loop. Anyone know the correct way of doing this?
Also I tried to zip a whole directory. I tested by creating a directory which contains 1.txt and 2.txt files. and used code:
$source=File_Archive::read("./tempfolder/");
$dest=File_Archive::toArchive("./data.zip", File_Archive::toFiles());
File_Archive::extract($source, $dest);
This created a data.zip file, but it contains three copies of 2.txt files for some reason.
Thanks