Welcome Guest, Not a member yet? Register   Sign In
file_write() - file helper
#1

[eluser]Bondie[/eluser]
Is there anyway of "backing up" a directory to a .gz using the file write, i tried the following....

I want to backup all of the folders/files in
Quote:./
aka the directories above index.php front controller thingy bob Wink

Code:
$filename = './../backups/backup';

write_file($filename.'.gz', './');
#2

[eluser]Bondie[/eluser]
any other suggestions of doing it would be lovely, please!!!! Smile
#3

[eluser]tomcode[/eluser]
You can do it using the directory helper and the zip encoding class.

1. Fetch the directory You want backup with the directory helper.
2. Traverse the array and add the files to a zip using the zip encoding class.
#4

[eluser]Bondie[/eluser]
Thanks, Didn't realise there was a directory helper, we learn something new everyday! Smile thanks for your help.
#5

[eluser]Bondie[/eluser]
After TomCodes help, I'm now using this code:
Code:
$this->zip->read_dir('./');
$this->zip->archive($filename);

although the zip is reporting as invalid?






- EDIT FIXED.
#6

[eluser]tomcode[/eluser]
Try
Code:
$this->zip->read_dir(realpath('./'));

What do You use as $filename ?

Does the created zip really contain data (have an adequate filesize) ?
#7

[eluser]Bondie[/eluser]
yeh, it just messed up when i used ftp class as ascii, so changed it to auto, transfering the zip to a remote server, working fine now, thanks Tom Smile




Theme © iAndrew 2016 - Forum software by © MyBB