Forum Moderators: coopster

Message Too Old, No Replies

Been thinking about...

Including data

         

Kami

11:09 pm on Mar 2, 2004 (gmt 0)

10+ Year Member



OK, I'm thinking about including all the txt files from a specified folder... and I'm having a few problems (not least because my friend has conveniently "borrowed" my PHP books. He's so dead when he brings them back! Not least because I dunno why he's got them... he doesn't even like computers!).

So, with the absence of my PHP books, and the lack of finding ANYTHING online about this (200 sites thru Yahoo... I feel ill!)... I thought I'd ask here - can I do this in a similar manner to displaying the files in a directory?

I know how to display a list of the files in a specified directory. I know how to include files. What I'm interested in is if theres a way to just "include" all the .txt files from a specified folder? I'm not putting 2 and 2 together very well here...

I dunno why I'm asking since right now I'm using a free downloads script which works fine. I guess I'm just curious because I want to learn... how would you do this?

coopster

1:06 am on Mar 3, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You will probably want to read about PHP's Directory [php.net] and File [php.net] Functions. There are lots of examples in the manual as well as the User Contributed notes.

Also, WebmasterWorld has covered this issue a few times!
check for folder content [webmasterworld.com]
Directory View [webmasterworld.com]
List files in directory - issue [webmasterworld.com]
Search a directory for only one file extension [webmasterworld.com]