Created
March 24, 2014 12:20
-
-
Save RyanNielson/9739104 to your computer and use it in GitHub Desktop.
Function to recursively remove a directory and all of its contents.
This file contains hidden or 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 rrmdir($dir) { | |
foreach(glob($dir . '/*') as $file) { | |
if(is_dir($file)) | |
$this->rrmdir($file); | |
else | |
unlink($file); | |
} | |
rmdir($dir); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment