开发者

Is it possible to check a file name exist no matter the file's extension in PHP on Windows XP?

开发者 https://www.devze.com 2023-02-14 16:20 出处:网络
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.[

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 . ".*")
0

精彩评论

暂无评论...
验证码 换一张
取 消