How can i check if file exists based on a partial file name?
file, php
Solution
You could use something similar to the following:
$fileSearch = "God_of_War";
$files = glob("/path/*" . $fileSearch . "*");
if(count($files) > 0) echo "File Exists!";
Problem
Im trying to check if a file exists in my folder but i only have a partial filename to check it against, Is there a way to check it? For example i have the following: ``` God_of_War ``` The filename is actually called: ``` God_of_War_PSP(USA).rar ``` Is there some kind of LIKE for file_exists function ? or can i use str_pos somehow ? Thanks