hello, i have this script which i will post absolutely unmodified:
<?
chdir("data");
$files = glob("*");
shuffle($files);
var_dump($files);
$i=0;
$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach($files as $file) {
$i++;
$k = $i;
$mime = finfo_file($finfo, $file);
if(strpos($mime,"gif") !== false) {
$ext = "gif";
} else {
$ext = "jpg";
}
if($k < 10) {
$k = "00".$k;
} else if($k < 100) {
$k = "0".$k;
}
$k = $k.".".$ext;
rename($file,$k);
echo $k."\n";
}
the folder data has some image files (jpg and gif) in it. but when i run it, suddenly a lot of images are just gone! 2/3rd of the images just got deleted... i don't understand how? i have an ext3 filesystem and PHP 5.3.2