<?php function RemoveDir($path) { if(file_exists($path) && is_dir($path)) { $dirHandle = opendir($path); while (false !== ($file = readdir($dirHandle))) { if ($file!='.' && $file!='..') { $tmpPath=$path.'/'.$file; chmod($tmpPath, 0777); if(file_exists($tmpPath) && (time()-filemtime($tmpPath))>1800) { unlink($tmpPath); } } } closedir($dirHandle); } else { echo "Удаляемой папки не существует или это файл!"; } } RemoveDir('get'); RemoveDir('temp'); ?>