View Single Post
Old 07-23-2010, 01:40 AM   #1 (permalink)
benton
The Contributor
 
Join Date: Apr 2008
Posts: 78
Thanks: 0
benton is on a distinguished road
Default How to keep directory structure in gzip

I'm trying to create a script to read my files and add them to a gzip file. The code below works except that the paths are not written. So if the code below is ran as it is, the file within the gzip file will have the full contents of both index.php files in one file. I want to have it keep the directory structure like is seen in such gz files. Would someone please point out where my mistake is?

PHP Code:
$filenames = array();
$filenames[] = 'a/index.php'
$filenames[] = 'a/b/index.php'

$zh gzopen('archive.gz'"w9");

foreach (
$filenames as $filename) {

  
$ifh fopen($filename'rb');  

  
gzwrite($zhfread($ifhfilesize($filename)));  
  
  
fclose($ifh);

benton is offline  
Reply With Quote