SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Almeaty Member
    Join Date
    Jul 2000
    Location
    Nowhere
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get all files in a directory?

    Is it possible with PHP to get all files that are located a given directory? I'd like to create a simple script that goes through each file, reads it, and puts in a new Mysql row.

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    Earth
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Howdy,

    Check out the opendir and readdir command.

    Frank
    http://www.serverexpert.com/ Discuss servers and the software that makes them work.
    http://www.webmasters-resources.com/ Resources for webmasters.

  3. #3
    Almeaty Member
    Join Date
    Jul 2000
    Location
    Nowhere
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kewl thanks, will check it out! =)

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish you people would stop saying opendir, the dir function is so much nicer to work with.

    http://www.php.net/dir

    PHP Code:
    $dir "images/";
    $d dir($dir);
    while(
    $file $d->read()) {
       print 
    "$file<br>";
       }
    $d->close(); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •