Check that a file name is of specific format

Hi champs,

Needed some urgent help on my scenario which is ,

Suppose, i have to receive file’s and i have to check the naming convention is correct or not for those files.

eg :- file name can be : 546565_BOL_mm_dd_yyyy ,(here mm stands for current month , dd for day and yyyy for year), and it should be the current day on which i am receiving the file,
some more examples are ,
167557_BOL_mm_dd_yyyy,
009098_BOL_mm_dd_yyyy,
645645_BOL_mm_dd_yyyy

Please help !!

feeel free to ask any doubts ,

Thanks in advance !!

@Shikhar_Tandon You can use a if condition and check for Filename.contains(“BOL”+DateTime.Now.ToShortDateString.Replace(“/”,“_”))

I have assumed Filename as variable which is the name of Filename you received. Change the above if condition as per your requirement.

DateTime.Now.ToShortDateString.Replace(“/”,“_”) will change the current date as 08_27_2020