Maybe I should clarify. When I use a windows path (c:\whatever) I get an error that it can't find the path. In Linux the same code works fine (/usr/local/whatever). Here is all the relevent info. Warning: opendir(f:\downloads\): failed to open dir: Invalid argument in c:\web\index.php on line 30 ***** This is line 30 - if ( $handle = opendir ( $page ) ) This is the code: $page = "f:\\downloads"; // $mode : "FULL"|"DIRS"|"FILES" // $d : must not be defined $display = searchdir($page); $num = count($display); $i = 0; for($i = 0; $i <= $num; $i++) { echo $i." ".$display[$i]."<br>"; } function searchdir ( $page , $maxdepth = -1 , $mode = "FILES" , $d = 0 ) { if ( substr ( $page , strlen ( $page ) - 1 ) != '\\' ) { $page .= '\\' ; } $dirlist = array () ; if ( $mode != "FILES" ) { $dirlist[] = $page ; } if ( $handle = opendir ( $page ) ) { while ( false !== ( $file = readdir ( $handle ) ) ) { if ( $file != '.' && $file != '..' ) { $file = $file ; if ( ! is_dir ( $file ) ) { if ( $mode != "DIRS" ) { $dirlist[] = $file ; } } elseif ( $d >=0 && ($d < $maxdepth || $maxdepth < 0) ) { $result = searchdir ( $file . '\\' , $maxdepth , $mode , $d + 1 ) ; $dirlist = array_merge ( $dirlist , $result ) ; } } } closedir ( $handle ) ; } if ( $d == 0 ) { natcasesort ( $dirlist ) ; } return ( $dirlist ) ; } ?> > -----Original Message----- > From: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx] > Sent: January 7, 2007 10:25 AM > To: Beauford > Cc: PHP > Subject: Re: Windows directory listings > > Beauford wrote: > > Hi, > > > > I am trying to write a script that reads a directory on > Windows. All > > the PHP functions I have looked at all seem to work with the Linux > > dietary > > it sounds more like you have found an examples that show > windows being used (i.e. windows file paths). > > > structure. Is there another way to do this. > > you must be reading a manual that only exists in your > particular parallel universe, all relevant php function work > in windows as well as linux: > > http://php.net/manual/en/ref.filesystem.php > http://php.net/dir > > > > > Thanks > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php