Last active
July 8, 2019 18:59
-
-
Save greg-randall/b852591c02af7b4ce1197a7f6d1e5e32 to your computer and use it in GitHub Desktop.
This tries to delete everything in it's directory and lower -- files and folders. I made this to delete some files with weird names that I couldn't delete over FTP. It will probably delete itself. Be really really sure you want this before you do this.
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
<pre> | |
<?php | |
//ARE YOU SURE YOU WANT TO DELETE EVERYTHING??? | |
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('.')); | |
foreach ($rii as $file) { | |
echo $file->getPathname() . "<br>"; | |
rmdir(realpath($file->getPathname())); | |
unlink(realpath($file->getPathname())); | |
system("rm -rf " . realpath($file->getPathname())); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment