无论Windows XP上的PHP文件扩展名是否都可以检查文件名是否存在?

问题描述:

E.g:

the Folder name:

myFolder

files inside myFolder:

myFolder.01.mkv
myFolder.01.avi
myFolder.02.avi

...

And I just want to check that the file name exist or not.Just like.[ ignore the extension]

file_exist('d:\\myFolder\\myFolder.01');

Thank you very much!!

[update]

I want to check the file exist before I re-name the file.But it seems that glob() function will not work when the file doesn't exist.

E.g:

$path = glob("d:\\myFolder\\myFolder.99.*"); // myFolder.99.* doesn't exist and glob didn't work

例如: p>

文件夹名称: p> \ myFolder中的

  myFolder 
  code>  pre> 
 
 

文件: p>

  myFolder.01.mkv 
myFolder  .01.avi 
myFolder.02.avi 
  code>  pre> 
 
 

... p>

我只想查看该文件 名称是否存在。就像。[忽略扩展] p>

  file_exist('d:\\ myFolder \\ myFolder.01'); 
  code>  
 
 

非常感谢!! p>

[更新] p>

我想在我之前检查文件是否存在 重命名文件。但是当文件不存在时,似乎glob()函数不起作用。 p>

例如: p>

  $ path = glob(“d:\\ myFolder \\ myFolder.99。*”);  // myFolder.99。*不存在且glob无法正常工作
  code>  pre> 
  div>

Use PHP's glob function to prevent specifying the extension. However this may result in a security issue:

http://ar2.php.net/glob

glob($file . ".*")