Assign filePath with the folder path which contains the files
reqFile variable will hold the path of required file.
Explanation of code : check if the filePath (e.g., TestFolder) contains the file starting with fileName (“11SP”). If No, then assign reqFile as Nothing. If yes, then assign the latest modified file’s path to the reqFile. So if there are two files with their name starting with the “11SP” then only the latest modified file’s will be assigned to the reqFile variable. This is as per your requirement (Output 2 files available, now need to compare with file modification date then get latest file)
If reqFile is Nothing, it means that there is no file matching the requirement (i.e Starting with fileName “11SP”). Nothing here means that the output is empty as you stated in your problem above.