Is it possible to check a file name exist no matter the file's extension in PHP on Windows XP?
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 li开发者_Python百科ke.[ 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
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 . ".*")
精彩评论