Recursive remove folder
This commit is contained in:
parent
b65ae0ab71
commit
5af9af91e1
@ -50,16 +50,15 @@ class RefreshCommand extends Command
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
function recursiveRemoveDirectory($directory)
|
||||
function recursiveRemoveDirectory($dir)
|
||||
{
|
||||
foreach(glob($directory . "/*") as $file)
|
||||
{
|
||||
if(is_dir($file)) {
|
||||
$this->recursiveRemoveDirectory($file);
|
||||
} else {
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
$files = array_diff(scandir($dir), array('.', '..'));
|
||||
|
||||
foreach ($files as $file) {
|
||||
(is_dir("$dir/$file")) ? $this->recursiveRemoveDirectory("$dir/$file") : unlink("$dir/$file");
|
||||
}
|
||||
rmdir($directory);
|
||||
|
||||
return rmdir($dir);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user