Created
December 21, 2020 11:23
-
-
Save amine-y/ce037d35d0a9f032f69228941b6c3fb6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| $dir = '/home/amine/public/deletehtaccess'; | |
| $result = shell_exec( 'find ' . $dir . ' -type f -iname ".htaccess" -print' ); | |
| if( !empty( $result ) ) { | |
| echo "\nFound the following files in [$dir]:\n" . $result; | |
| $hidden_files = explode("\n", trim($result) ); | |
| } else { | |
| echo "\nFound no hidden files in [$dir].\n"; | |
| } | |
| if( !empty( $hidden_files ) ) { | |
| // now, lets remove em | |
| foreach( $hidden_files as $strFileName ) { | |
| echo "\nRemoving $strFileName ..."; | |
| if( unlink( $strFileName ) != false ) { | |
| echo " done.\n"; | |
| } else { | |
| echo " failed!\n"; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment