Results 1 to 4 of 4

Thread: Echo files in a directory?

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Echo files in a directory?

    Hello,

    How do I echo all the files in a directory? I am a beginner at all this, so forgive me.

    Thanks.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Ok, thanks. Will look into it.

  4. #4
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    PHP Code:
    $files glob('*.*');
    $files array_filter($files'is_file');

    if(
    count($files))
    {
        echo 
    '<ul>';
    }
    foreach(
    $files as $file)
    {
        echo 
    '<li>' basename($file) . '</li>';
    }
    if(
    count($files))
    {
        echo 
    '</ul>';


Bookmarks

Posting Permissions

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