Jump to content

Archived

This topic is now archived and is closed to further replies.

madspof

can anyone see what wrong with this script

Recommended Posts

i cannot get this script to work
<?php
   
function scan_folder($dir) {
    $handle = opendir($dir);
   
    while ($file = readdir($handle)) {
        if (is_dir("$dir\\$file")) {
            if (!ereg("^\.+", $file)) {
                $files .= scan_folder("$dir\\$file");
            }
        } else {
            if (@eregi($_POST['matches'], $file)) {
                $files .= "$dir\\$file" . "\n";
            }
        }
    }
    closedir($handle);
   
    return $files;
}

// Add the Directory root you want to scan

$dir = "C:\stuff4free\newsite\music";

// This is how you use the function. Simple!

echo scan_folder($dir);
?>

Share this post


Link to post
Share on other sites
Please tell us how you're using this. What errors do you get?

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.