Jump to content


Photo

can anyone see what wrong with this script


  • Please log in to reply
1 reply to this topic

#1 madspof

madspof
  • Members
  • PipPipPip
  • Advanced Member
  • 271 posts

Posted 03 September 2006 - 04:29 PM

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);
?>

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 03 September 2006 - 04:35 PM

Please tell us how you're using this. What errors do you get?

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users