Kristopher Spencer-Yates wrote:
//PHP4
$dir_to_scan = "website.com/htdocs";
$dir_handle = opendir($dir_to_scan);
while($filename = readdir($dir_handle)){
       if(is_dir($filename)){
               $files_in_scan[] = $filename;
               }
       else{ echo"$filename is not a directory.<br>\n"; }
       }
sort($files_in_scan);
print_r($files_in_scan);

The above script properly reports that ".", "..", and "images" are drwx[directories] by adding them to the $files_in_scan array. HOWEVER, my problem is that there are other directories.. quite a few actually.. and above script will say, as an example:

pdf_directory is not a directory

But I know 'pdf_directory' *is* in fact a directory in 'website.com/htdocs'. Is this a problem with PHP4 or have I somehow 'miscoded' what I'm attempting to do?

I would do this in PHP5 but the admin won't upgrade, so I am stuck in PHP4 land w/ this project I am on.

Thanks for any advise,

You have to either supply the root path to the 'suspected' directory, ie /path/from/root/pdf_dir, or change the working directory. Right now, it's looking in the directory that php is currently working in.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to