Results 1 to 4 of 4

Thread: How to tell if file is a directory (PHP)

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    How to tell if file is a directory (PHP)

    If I am reading all the files using readdir() how can I tell if the file is another dir?
    PHP Code:
    if (file is a directory)
    {
      echo 
    "directory<br>";
    }
    else
    {
      echo 
    "file<br>";

    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    if (is_dir($file))
    {
    echo "directory"
    }
    else
    {
    echo "file"
    }

  3. #3

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Thanks
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    hehehhe, no probs

    Is that you in your avatar?

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