Skip to content

Instantly share code, notes, and snippets.

@jairoFernandez
Created July 12, 2017 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jairoFernandez/fd157cbff6e611f713318a525187b5d8 to your computer and use it in GitHub Desktop.
Save jairoFernandez/fd157cbff6e611f713318a525187b5d8 to your computer and use it in GitHub Desktop.
Delete a folder with PHP
public function removeDirectory($path) {
if(is_dir($path)){
$files = glob($path . '/*');
foreach ($files as $file) {
is_dir($file) ? $this->removeDirectory($file) : unlink($file);
}
rmdir($path);
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment