Clean Folder in PHP


$debug='false';
$folder='book/pages/';

if ($debug) {
// echo "Cleaning folder $folder ...
";
}

$d = dir($folder);

while (false !== ($entry = $d->read())) {

$isdir = is_dir($folder."/".$entry);

if (!$isdir and $entry!="." and $entry!="..") {

unlink($folder."/".$entry);

} elseif ($isdir and $entry!="." and $entry!="..") {

empty_folder($folder."/".$entry,$debug);

rmdir($folder."/".$entry);

}
}
$d->close();

POPULAR POSTS ::

Add multiple upload box

String Separation

Only number restrictions

Addslashes

Add and Separate more records by comma operator

The top Web development PHP frameworks

HTML Document structure and it's Syntax format