getting a complete file list?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

getting a complete file list?

Post by irealms »

Is there any way of generating a text list of all files within a folder and sub folders?
Judas
Forum Commoner
Posts: 67
Joined: Tue Jun 10, 2003 3:34 pm
Location: Netherlands

Post by Judas »

sure there is.

here is a function i wrote.

Code: Select all

function readFiles($map){
if ($handle =@ opendir($map)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
        $filesї]=$map.'/'.$file;
        }
    }
    closedir($handle);
}

if (!empty($files)){return $files; }
}
Post Reply