How to check the if the date in between from a file name with path


“C:\Users\Ahiwa\Desktop\10-1\Book1 (as of 12.2.2021).xlsx”
like this i have the folder name
once i get the path i have to check if this folder name date is in between 25th or 28th
how can i do it

Hi @Tharusha_Fernando

First try to get only the folder name with below,
Use “Directory.GetFiles(selectFolder,” . “,SearchOption.AllDirectories)”

image

Then, you can use spilt functions to Get 10th from folder name,
after take a if condition to check the folder date in between 25th or 28th.

Thanks
Latika

1 Like

hi @Latika10011740 when i try to convert the string to date time i m getting an error on string not match the date time format

Hi @Tharusha_Fernando …So you want to extract the date from file name and check for the conditions right?

C:\Users\Ahiwa\Desktop\10-1\Book1 (as of 12.2.2021).xlsx…

1 Like

@Tharusha_Fernando - you can try like this…

image

Write Line: StrOutput(0).ToString.split("."c)(0)

IntDate = Cint(StrOutput(0).ToString.split("."c)(0))

If Condition

image

Output
image

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.