Create a text file of a directory listing?
Posted on 2003-12-08
This has probably been covered, but an hour of searching hasn't helped me yet...
What I'd like to do is have a php script that would read the contents of a directory, and then write the result to "list.txt" in the same directory. However, I have two requirements of the text file:
(1) it must list only .jpg, .gif. or .png files.
(2) it must generate the list alphabtically. (I thought this would have been automatic, but oddly enough it doesn't seem to that way on my server.)
For example, when I call "the_script_i_require.php" it will hunt throgh this:
...and leave "list.txt" containing only:
Thanks in advance for any assistance.