

Then replace the ? with a * (theFileName.Replace("?", "*")) would replace all ? found with a * instead, then do the above, then go through each of the files found (another iteration) and do the if (File.Exists(currentFile)) etc.ĭoes this help you? (hope it doesnt make you confused!) I think I've now made myself confusedĮdit: you may wish to look at this for understanding on how the GetFiles() works: Or IF the filename/value returned is like this, as is: So if I had these values returned to me, as is: String theFiles = System.IO.Directory.GetFiles( path, theFileName + "*") //would get all the files that match the filename given. Ok, so, if you have this returned: 11223344_101_ then in my initial reply (I think), do the whole Directory.GetFiles() thing to get a list of files that match that criteria. There will never be more then one file with that matches the "11223344_101_" scheme however.

The "12" is the random value in this exampleĬool, just pass this into the "Exists" method, along with the path you want to check.as suggested above (so it could be 11223344_101_13.jpg, _14._15.

Well the whole System.IO.File.Exists( path\filename) does this for you, you just need to replace the bold text - it checks to see if the given path and file exists.
