Last active
November 17, 2018 09:29
-
-
Save TheYkk/14906c4660a46a228bc156cb67abbd5d to your computer and use it in GitHub Desktop.
Zip all file from directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_directory_list($dir = '*') | |
{ | |
static $files = []; | |
foreach (glob($dir) as $file) { | |
if (is_dir($file)) get_directory_list($file . '/*'); | |
else $files[] = $file; | |
} | |
return $files; | |
} | |
$files = get_directory_list('dosyalar/*'); | |
$zip = new ZipArchive(); | |
$zip->open('prototurk.zip', ZIPARCHIVE::CREATE); | |
foreach ($files as $file) { | |
$zip->addFile($file); | |
} | |
$zip->close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment