pugboy Posted July 5, 2008 Share Posted July 5, 2008 I am trying to find a way to list all of the folders within a directory (or rather put them in an array) How would I go about doing this? I have searched for a function, and have come up with nothing EDIT: Scan dir seems what I want... Link to comment https://forums.phpfreaks.com/topic/113287-solved-listing-folders-in-a-directory/ Share on other sites More sharing options...
PC Nerd Posted July 5, 2008 Share Posted July 5, 2008 $handler = opendir($directory); // keep going until all files in directory have been read while ($file = readdir($handler)) { if(is_dir($file)) { ... do your stuff } } EDIT: YesI got that of google: "php, list directory files" - and of php.net documentation on files - ctrl + f "dir"........ check out the documentation there theres a large list of functiosn tha will help you. Link to comment https://forums.phpfreaks.com/topic/113287-solved-listing-folders-in-a-directory/#findComment-582040 Share on other sites More sharing options...
pugboy Posted July 5, 2008 Author Share Posted July 5, 2008 I did find a function off of the doc, but it didn't work... Thanks though, I will try your code. Link to comment https://forums.phpfreaks.com/topic/113287-solved-listing-folders-in-a-directory/#findComment-582043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.