On Fri, Nov 26, 2010 at 19:03, Kirk Bailey <kbailey@xxxxxxxxxxxxxxxx> wrote: > > I need a routine that will return a list of every directory immediately > under the current directory- but nothing else, just a list of directories, 1 > level deep, NO FILES, no listing of current dir or prior dir either. Simple: <?php $ls = scandir(dirname(__FILE__)); foreach ($ls as $d) { if (is_dir($d) && $d != '.' && $d != '..') { echo '<a href="'.$d.'">'.$d.'</a><br/>'.PHP_EOL; } } ?> If you want something more powerful - and often quicker - check into SPL: specifically FilesystemIterator[1], DirectoryIterator[2], and RecursiveDirectoryIterator[3]. A quick example to link all child files and directories with relative linking: <?php $path = dirname(__FILE__); $list = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); foreach ($list as $k => $v) { if (!preg_match('/\./',$v)) { $v = str_replace($path.'/',null,$v); // We only want relative linking echo '<a href="'.$v.'">'.$v.'</a><br/>'.PHP_EOL; } } ?> -- </Daniel P. Brown> Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php