Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Jackie Craig Sparks [email protected] 336.790.2126
- //http://www.communicationslibrary.info http://www.phonesnake.com
- error_reporting(E_ALL);
- $imgpath="/var/www/imagescript";
- $imgext="png";
- $newdirname=date("y.m.d");
- $pwd=getcwd();
- if(mkdir("{$pwd}/{$newdirname}", 0700)){
- echo "Directory Created \n";
- if ($handle = opendir($imgpath)) {
- while (false !== ($file = readdir($handle))) {
- $imagename=strstr($file,'.',true);
- echo "$imagename\n";
- if($imagename != ""){
- if(copy("{$pwd}/{$imagename}.{$imgext}" ,"{$pwd}/{$newdirname}/{$imagename}.{$imgext}")){
- echo "Copy sucessfull\n";
- if(unlink("{$pwd}/{$imagename}.{$imgext}")){
- echo "Delete sucessfull";
- }else{
- echo "Delete failed: {$pwd}/{$imagename}.{$imgext}";
- }
- }else{
- echo "Copy failed {$pwd}/{$imagename}.{$imgext} to {$pwd}/{$newdirname}\n";
- }
- }
- }
- closedir($handle);
- }else{
- echo "Directory creation failed: {$pwd}/{$newdirname}";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment