I think this may be the fastest way to get a list of all the directories in a given folder/directory using PHP.

[code lang=”php”]$directories = array_filter(glob(‘*’), ‘is_dir’);[/code]

..and of course you can also add a path to it if you need to:

[code lang=”php”]$directories = array_filter(glob($myPath.’*’), ‘is_dir’);[/code]

1 Comment

Mike Collier · April 29, 2011 at 14:11

just brilliant – took some finding on the web but works just fine for what i want for an automatic picture gallery where each event has its own folder of pics

Leave a Reply

Your email address will not be published.

%d bloggers like this: