PHP deletes the entire directory that matches the criteria 
 
 
    PHP
 /** * @name The Delfile function is used with the Deldir function to delete the entire directory that matches the condition * @param string $path Specify the action path * @return    Null * @example deldir (' D:\web\Apache\htdocs\KeyShareMall\Pc\ThinkPHP '); */
  
Delete DirectoryfunctionDelfile ($path)    {        if(Empty($path)) {            Echo' Specify the file path to be manipulated '; return false; }        if($handle=Opendir($path )) {             while(false!== ($fileName=Readdir($handle ))) {                if($fileName!=  "." &&$fileName!=  ".." ) {                                        if(Is_file($path. '/' .$fileName)) {                        unlink($path. '/' .$fileName); }                    if(Is_dir($path. '/' .$fileName) {delfile ($path. '/' .$fileName); }                }            }            rmdir($path); Closedir($handle ); }    }    functionDeldir ($path= '')    {        if(Empty($path)) {            Echo' Specify the file path to be manipulated '; return false; } Else {            $path=Str_replace('\\', '/',$path); }        if($handle=Opendir($path)) {             while(false!== ($fileName=Readdir($handle ))) {                if($fileName!=  "." &&$fileName!=  ".." ) {                    if(Is_dir($path. '/' .$fileName)) {                        Echo $fileName. "
"; //Delete a directory containing zip characters                        if(Strpos($fileName, ' Zip ')!==false) {Delfile ($path. '/' .$fileName); } Else{Deldir ($path. '/' .$fileName); }                    }                }            }            Closedir($handle ); }    }        deldir (' D:\web\Apache\htdocs\KeyShareMall\Pc\ThinkPHP ');?>