SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to find if a file is a dir on ftp..

    Is there anyway when using code similar to...

    $files=ftp_nlist($conn_id, ".");
    foreach($files as $file){
    echo "$file<BR>";
    }

    to find out whether $file is a directory in each case?

    Thnx
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could do:
    if (ftp_chdir($conn_id,$file) && ftp_cdup($conn_id)){
    //is directory
    }
    Last edited by Anarchos; Aug 11, 2001 at 21:43.
    ck :: bringing chris to the masses.

  3. #3
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that but it doesnt seem to work, already tried it
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  4. #4
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hehe...you changed your post, that might work actually ill have a try!

    EDIT:
    Thanks! That does work but it slows things down a bit!

    Anyone got a faster solution?
    Last edited by mad-onion; Aug 11, 2001 at 21:57.
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  5. #5
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use ftp_rawlist: http://php.net/manual/en/function.ftp-rawlist.php but you'll have to do some parsing. The comments on that page give some good functions.
    ck :: bringing chris to the masses.


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
  •