Created
October 29, 2015 07:26
-
-
Save iredun/3a0f8fe81a7bfe8b5072 to your computer and use it in GitHub Desktop.
Функция для удаления директорий с вложенными файлами, возвращает 1 если удаление прошло успешно.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function delTree($dir) | |
{ | |
$files = array_diff(scandir($dir), array('.','..')); | |
foreach ($files as $file) { | |
(is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); | |
} | |
return rmdir($dir); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment