Created
October 11, 2015 06:21
-
-
Save justinhough/725f70540f151763cb8f to your computer and use it in GitHub Desktop.
PHP Directory Listing
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 | |
| foreach (glob("*.txt") as $filename) { | |
| echo "$filename size " . filesize($filename) . "\n"; | |
| } | |
| preg_grep('#\.zip$#', glob('/dir/somewhere/*'), PREG_GREP_INVERT) | |
| // http://cowburn.info/2010/04/30/glob-patterns/ | |
| if (fnmatch("*gr[ae]y", $color)) { | |
| echo "some form of gray ..."; | |
| } | |
| //Easy way to get rid of the dots that scandir() picks up in Linux environments: | |
| $directory = '/path/to/my/directory'; | |
| $scanned_directory = array_diff(scandir($directory), array('..', '.')); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment