Page 1 of 1

How to get the name of every folder in a directory?

Posted: Sat Aug 01, 2009 10:29 am
by insight
I was wondering if there is a php code which will get every name of every folder in a directory. For example.

Root directory/public_html/modules and inside modules there will be folders such as News, Menu, Shoutbox, Gallery etc etc. I want to get the name of each folder in the modules directory so I can put it in a select list.

Nevermins the directory I showed you it was just an example, I just need the code and I will modify it myself accordingly.

Cheers
insight

Re: How to get the name of every folder in a directory?

Posted: Sat Aug 01, 2009 10:34 am
by jackpf
You could look into glob() and is_dir().

Re: How to get the name of every folder in a directory?

Posted: Sat Aug 01, 2009 10:35 am
by insight
Just realised, I don't need it :P I have all the folders in a database.

EDIT: But it may help in the future so thanks for your input :)