Re: Help w/ exec() on Win2k, IIS5.
| From: | Tobias Talltorp | Date: | Thu, 29 Mar 2001 17:03:42 +0000 |
| Subject: | Re: Help w/ exec() on Win2k, IIS5. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46120@lists.php.net to get a copy of this message | ||
I have had this problem with exec, passthru with that configuration
aswell...
To read the files into an array, do this:
(http://www.php.net/manual/en/function.opendir.php)
<?php
if ($dir = @opendir("e:\\dir")) { // Notice the double "\\"
while($file = readdir($dir)) {
if ($file !="." && $file !="..") // If you don´t want the . and ..
$files[] = $file;
}
}
closedir($dir);
}
// Print the array
for ($i=0; $i<sizeof($files); $i++)
echo $files[$i]."<br>";
}
?>
// Tobias
"SHAWN" <Shawn@On-Site-Solutions.com> wrote in message
news:D1FF6C0809A9D411815D0050DA841BCC3EE5@ONSITESERVER...
> Using IIS5 on W2K Server, I can't get get the exec() or other similar
> commands to work.
>
> This is what I'm doing -
>
> exec( "dir/a-d/b $dir_name", $arFiles )
>
> The array doesn't contain anything! I've tried it with cmd.exe before the
> command, but it just seems to get stuck in a loop! Can anyone tell me how
to
> successfully use this command? Or if not, any other ideas on how to get
the
> file names inside a directory into an array?
>
> Thanks in Advance,
>
> Shawn Sellars
>
>