• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Zip class question

#1
[eluser]welded[/eluser]
I'm using the zip class to make a backup of one directly and save the resulting zip file to another. It works great, but maintains the parent directory structure when I just want the files. To illustrate:
Code:
The data to save:
/datastore
    /xml
        file.xml
        another-file.xml
        yet-another-file.xml
        ...

Where to save it:
/datastore
    /backups
        backup1.zip
        backup2.zip
        ...

Downloading and extracting 'backup1.zip' shows the datastore/xml directories and I just want the XML files. Here's the code I've used:
Code:
$this->load->library('zip');

$this->zip->read_dir('./datastore/xml/');
$filename = 'xml-'.date('Y.m.d-H.i.s').'.zip';

$this->zip->archive('./datastore/backups/'.$filename);

Do I need to not use read_dir and instead parse the directory and add each XML file individually?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.