Created
October 29, 2016 16:57
-
-
Save SmetDenis/56a801b0ba0f3fa5127d699614be71e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| if(!function_exists('exec')) die('exec function is not available on this server'); | |
| if(!$unzip_command = exec('/usr/bin/which unzip')) die(); | |
| if(!$dir_handle = opendir(getcwd())) die ('Can\'t open dir'); | |
| while(false != ($files = readdir($dir_handle))){ | |
| if($files != '.' && $files != '..'){ | |
| if(preg_match('/.\.zip/',$files)){ | |
| exec("$unzip_command $files",$output); | |
| echo '<b>Unzipping ',$files,' </b><br>'; | |
| foreach($output as $unzipped_files) | |
| echo "$unzipped_files",'<span style="color: green"> done!</span><br>'; | |
| } | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment