|
Posted by "Richard Lynch" on 10/23/05 03:26
On Sat, October 22, 2005 7:12 pm, Jonny Bergström wrote:
> Good idea yes. But apparantly Windows couldn't do it either. :-(
>
> function file_exists_windows($path) {
> exec('dir ' . $path, $output, $return_status);
> return $return_status == 0 ? true : false; // Windows dir will return
> 0 when
> something was found
> }
First, I don't think $return_status is what you think it is.
$return_status is FALSE if your command is not syntactically valid.
It will be TRUE if your command is syntactically valid, but you'll
need to LOOK at $output to see if the file is listed or not.
> It works with "normal" ascii file names, but other than that it's a
> no.
> Makes you wonder what the problem is here, maybe exec() not supporting
> unicode either.
If the filename is funky, you are going to have to do whatever you
would do in a DOS prompt to escape it, munge, or otherwise convert it
to whatever that version of Windows uses.
Inlucding 8.3 on ancient Windows, if PHP runs on that junk.
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|