Skip to content

Instantly share code, notes, and snippets.

@liconti
Created April 20, 2012 06:26
Show Gist options
  • Save liconti/2426567 to your computer and use it in GitHub Desktop.
Save liconti/2426567 to your computer and use it in GitHub Desktop.
PHP recursive rmdir
<?php
function rrmdir($path){
if (is_dir($path)) {
array_map( "rrmdir", glob($path . DIRECTORY_SEPARATOR . '{,.[!.]}*', GLOB_BRACE) );
@rmdir($path);
}
else {
@unlink($path);
}
}
?>
@ribafs
Copy link

ribafs commented Nov 4, 2019

Não se deve usar o @, mas sim tratar mesmo que seja trabalhoso.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment