/ Published in: PHP
This function empties the folder recursively. Two parameters are passed in the function, First one is the directory to be emptied and second one is the flag to determine whether to delete the given folder. If set 'true', given folder is also removed at last. If emptying is our need then you should pass 'false'.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function emptyDirectory($dirname,$self_delete=false) { if (!$dir_handle) return false; if ($file != "." && $file != "..") { else emptyDirectory($dirname.'/'.$file,true); } } if ($self_delete){ } return true; }