Deletes a directory in the server’s file system.

function deleteDirectory($dir, $DeleteMe) {
  if(!$dh = @opendir($dir)) return;
  while (false !== ($obj = readdir($dh))) {
    if($obj=='.' || $obj=='..') continue;
    if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true);
  }
  closedir($dh);
  if ($DeleteMe){
  @rmdir($dir);
}

Related Posts Plugin for WordPress, Blogger...