Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function delete_dir_safety($file_path){
- $files=scandir($file_path);
- foreach ( $files as $item) {
- if ($item==='.'||$item==='..')
- continue;
- if (is_dir($file_path))
- delete_dir_safety($file_path.DIRECTORY_SEPARATOR.$item);
- else
- unlink($file_path.DIRECTORY_SEPARATOR . $item);
- }
- rmdir($file_path);
- if (!is_dir($file_path))
- return true ;
- else
- return false ;
- }
Advertisement
Add Comment
Please, Sign In to add comment