Query::Directory Traversing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
randomblink
Forum Commoner
Posts: 51
Joined: Wed Jan 28, 2004 11:27 am
Location: Tulsa, Oklahoma, just this side of hell...
Contact:

Query::Directory Traversing

Post by randomblink »

I have looked around the forums...
And I have looked around PHPClasses...
And I am stumped...

What I would LIKE is a Class that simply traverses Directories...
A PERFECT Class would be given a root directory...
And it would go through ALL of the folders and subfolders in those directories and return an array of $files.

$file['path'] would include the path to the file...
$file['name'] would be the name of the file...
etc... Each array key would hold a piece of file information...

I want to use this for a massive INCLUDE...
I want to be able to point to:
public_html/libraries/<libraryname>/classes

Then I want to include all files in THAT folder that start with:
class_*.php

This way I just name all of my class files ' class_<filename>.php ' and then I can tell it to grab the classes from a <certain library>... and voila!

Any help would be appreciated... Thanks...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

using opendir()/readdir() or glob() will help you create such an array.
randomblink
Forum Commoner
Posts: 51
Joined: Wed Jan 28, 2004 11:27 am
Location: Tulsa, Oklahoma, just this side of hell...
Contact:

Your Assistance Is Appreciated

Post by randomblink »

Thanks Feyd -

I will have to look into glob(). I have seen you mention it on several other posts, I am not even sure if I run the most current version of PHP... Have to check if glob() is even in there... Thanks tho...
Post Reply