Demonic Posted November 21, 2006 Share Posted November 21, 2006 Can someone tell me how I can list all subdirectory in a directory?like: Main Directory>Sub1>Sub2then check it in a script so the directories come up in a select box<select name="dir"><?php//while statement here?><option value="directoryname">Directoryname</option><?php}//end that whilestatement?></select>Anybody got ideas on how to do that? Thanks. Link to comment https://forums.phpfreaks.com/topic/28028-detecting-a-directory/ Share on other sites More sharing options...
fert Posted November 22, 2006 Share Posted November 22, 2006 glob() Link to comment https://forums.phpfreaks.com/topic/28028-detecting-a-directory/#findComment-128234 Share on other sites More sharing options...
brendandonhue Posted November 22, 2006 Share Posted November 22, 2006 [code=php:0]print_r(glob('*', GLOB_ONLYDIR));[/code] Link to comment https://forums.phpfreaks.com/topic/28028-detecting-a-directory/#findComment-128235 Share on other sites More sharing options...
Demonic Posted November 22, 2006 Author Share Posted November 22, 2006 Thats how you do it :D[code]<?php echo '<h1>Index of /styles/</h1>'; echo '<ul>'; echo '<li><a href="/"> Parent Directory</a></li>';$a = (glob('styles/*', GLOB_ONLYDIR)); foreach($a as $v){ echo "<a href='/".$v."'>".$v."</a><br />"; } echo '</ul>';?>[/code] Link to comment https://forums.phpfreaks.com/topic/28028-detecting-a-directory/#findComment-128243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.