function user_delete_backup_remove_dir in User Delete 5
Same name and namespace in other branches
- 6 user_delete.module \user_delete_backup_remove_dir()
Recursive delete a folder with files
1 call to user_delete_backup_remove_dir()
- user_delete_backup_remove_expired in ./
user_delete.module - Check if a folder is expired and delete
File
- ./
user_delete.module, line 289 - User delete - Let users delete their own account.
Code
function user_delete_backup_remove_dir($dir) {
if (!file_exists($dir)) {
return TRUE;
}
if (!is_dir($dir)) {
return unlink($dir);
}
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') {
continue;
}
if (!user_delete_backup_remove_dir($dir . DIRECTORY_SEPARATOR . $item)) {
return FALSE;
}
}
return rmdir($dir);
}