Hello All,
I have a small script that is supposed to move all .JPG files in a directory into a folder dated for today. It makes the directory but doesn't move any files and throws this error.
Warning: Wrong parameter count for strstr() in /home4/cyberpup/public_html/starbannerphoto/livephoto/cleanup.php
This is a bluehost account. PHP5, Linux/apache environment
Here's the script
Thanks you for your help,
Alan
I have a small script that is supposed to move all .JPG files in a directory into a folder dated for today. It makes the directory but doesn't move any files and throws this error.
Warning: Wrong parameter count for strstr() in /home4/cyberpup/public_html/starbannerphoto/livephoto/cleanup.php
This is a bluehost account. PHP5, Linux/apache environment
Here's the script
Code:
<?php error_reporting(E_ALL); $imgpath="/home4/cyberpup/public_html/starbannerphoto/livephoto"; $imgext="JPG"; $newdirname=date("y.m.d"); $pwd="/home4/cyberpup/public_html/starbannerphoto/livephoto"; if(mkdir("{$pwd}/{$newdirname}", 0755)){ 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}"; } } ?>
Alan
Comment