Re: Re: file_exists()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux