Jump to content

get a list of all directories


aebstract

Recommended Posts

 

$dir = 'gallery/';
$categories = scandir($dir);
$categories = array_slice($categories, 2);

 

The reason I am slicing is because it returns 2 extra values "." and ".." that I do not need. When I run this, I'm getting back folders and files, obviously. How can I get a list of only the directories? I'm going to need to be able to do the same and get only files as well. Working with nothing but .jpg and folders here.

 

 

Link to comment
https://forums.phpfreaks.com/topic/201526-get-a-list-of-all-directories/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.