PHP- Kodu:
<?
// Bildiriyi ayarla
error_reporting("E_ALL & ~E_NOTICE");
// Zaman Aşımı Ayarla
set_time_limit(0);
// Klasör ismi
$klasor = "deneme";
// Silinecek Uzanti
$uzanti = "gif";
// Uzantı Bulma fonksiyonu
function tipBul($dosya)
{
$dosya = explode(".",$dosya);
$uzanti = count($dosya)-1;
return $dosya[$uzanti];
}
// Silme İşlemi
$dizin = opendir($klasor);
while ($dosya = readdir($dizin))
{
if ($dosya != "." || $dosya != "..")
{
if (tipBul($dosya) == $uzanti)
{
if (unlink($klasor."/".$dosya))
{
echo $dosya,"--> Dosyası Silindi";
}
}
}
}
closedir($dizin);
?>
alternatif olabilir.. Script klasör ile aynı dizinde olmalı + chmod ayarları yapılmış olmalı yoksa silemezsiniz localde ise sorun olmaz.