Scooby08 Posted August 17, 2010 Share Posted August 17, 2010 I'm just trying to find out if php has the ability to check if any file exists, with only part of the filename given.. I have this path: if (file_exists($dir.'/'.$c_file.'/templ_*')) { I added a little star.. That star represents whatever the rest of that file is named for this example.. It could be anything.. So can php match any files that start with "templ_", and say that it does or does not exist?? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/210981-file_exists-with-only-part-file-name/ Share on other sites More sharing options...
wildteen88 Posted August 17, 2010 Share Posted August 17, 2010 file_exists will only function correctly if the full (path and) filename are present, It doesn't support wildcards. You may want to look into the glob function. Quote Link to comment https://forums.phpfreaks.com/topic/210981-file_exists-with-only-part-file-name/#findComment-1100416 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.