Delete unlimited level directory and file code sharing (stationmaster is originally original)
// Delete the directory
// This program is originally created by WM_CHIEF, if you want to reprint, please indicate your author and source (http://www.phome.net)
Class del_path
{
Function WM_CHIEF_DELPATH ($ DEL_PATH)
{
IF (! file_exists) // The target directory does not exist
{echo "directory does not exist"; return false;}
$ HAND = OpenDir ($ del_path);
$ I = 0;
While ($ file = readdir ($ HAND))
{$ i ;
IF ($ i == 1 || $ i == 2)
{Continue;
IF (! ($ file, ")))))))
{
$ DEL_S_PATH = $ del_path. "/". $ file;
$ this-> wm_chief_delpath ($ del_s_path);
}
Else
{
$ del_file = $ del_path. "/". $ file;
$ this-> wm_chief_file ($ del_file);
}
}
CloseDir ($ HAND);
$ this-> wm_chief_path ($ del_path);
Return True;
}
//Delete Files
Function WM_CHIEF_FILE ($ DEL_FILE)
{
Unlink ($ del_file);
}
// Delete the directory
Function WM_CHIEF_PATH ($ DEL_PATH)
{
RMDir ($ del_path);
}
}
$ Delpath = "Delpath"; // To delete the directory
$ WM_CHIEF = New del_path ();
$ WM_CHIEF_OK = $ WM_CHIEF-> WM_CHIEF_DELPATH ($ DELPATH);
IF ($ WM_CHIEF_OK)
{
Echo "Deleted";
}
// This program is originally created by WM_CHIEF, if you want to reprint, please indicate your author and source (http://www.phome.net)
?>