Results 1 to 3 of 3

Thread: get directories at location [Resolved]

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    get directories at location [Resolved]

    I have several folders on my website which all contain pages for different users. Is there any way to get the names of all of those folders so I can make links out of them on a page?

    I tried using scandir(), but that's only a PHP 5 function and I'm running 4.3.4
    Last edited by ober0330; Feb 23rd, 2004 at 12:29 PM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    If your setup is something like this:

    Code:
    users
        user1
        user2
        user3
    Then you can do:

    Code:
    <?php
    
    if ($handle = opendir('/home/your_site/public_html/users')) {
        while (false !== ($file = readdir($handle))) { 
            if (is_dir($file) && $file != '.' && $file != '..') {
                echo $file . '<br />';
            }
        }
    
       closedir($handle); 
    }
    ?>
    That's just from memory, but something like that.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Excellent. Thank you very much.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width