note 108022 added to ziparchive.addemptydir
| From: | pong_pc2 at hotmail dot com | Date: | Fri, 23 Mar 2012 03:31:16 +0000 |
| Subject: | note 108022 added to ziparchive.addemptydir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186779@lists.php.net to get a copy of this message | ||
Shouldn't it be this one. I've try Dayjo's and D.Jann's but neither of that
works.
So I've change something and it's working.
<?php
// Function to recursively add a directory,
// sub-directories and files to a zip archive
function addFolderToZip($dir, $zipArchive, $zipdir = ''){
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
//Add the directory
if(!empty($zipdir)) $zipArchive->addEmptyDir($zipdir);
// Loop through all the files
while (($file = readdir($dh)) !== false) {
//If it's a folder, run the function again!
if(!is_file($dir . "/" . $file)){
// Skip parent and root directories
if( ($file !== ".") && ($file !== "..")){
addFolderToZip($dir . "/" . $file, $zipArchive, $zipdir . $file .
"/");
}
}else{
// Add the files
$zipArchive->addFile($dir . "/" . $file, $zipdir . $file);
}
}
}
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 110.171.68.93
----
Manual Page -- http://www.php.net/manual/en/ziparchive.addemptydir.php
Edit -- https://master.php.net/note/edit/108022
Del: integrated -- https://master.php.net/note/delete/108022/integrated
Del: useless -- https://master.php.net/note/delete/108022/useless
Del: bad code -- https://master.php.net/note/delete/108022/bad+code
Del: spam -- https://master.php.net/note/delete/108022/spam
Del: non-english -- https://master.php.net/note/delete/108022/non-english
Del: in docs -- https://master.php.net/note/delete/108022/in+docs
Del: other reasons-- https://master.php.net/note/delete/108022
Reject -- https://master.php.net/note/reject/108022
Search -- https://master.php.net/manage/user-notes.php