How to check file exists in folder or not

Hello Friends,

In folder i have .xls file like below
TASK_todaydate_int valuve


  1. TASK_20230329_071623830
  2. TASK_20230328_07233067

I wanted to check file exists or not…i am using path exists active…how to ignore int value while check ?

Hi @Bot_Learner

You can use the following activity:


Hope this helps,
Best Regards.

PartialFileName = “TASK_20230329”
If item.ToString.Contains(PartialFileName)

Hi @Bot_Learner ,

Considering that you would want to find if today’s date file is present or not irrespective of the number values after it, Maybe we would need to switch to the below Expression and apply it directly in an If activity :


Let us know if you are still having issues in resolving this.

1 Like

Hi @Bot_Learner ,

Use the following to get the files using your desired pattern, and use the if condition based on if the count is greater than 0:


1 Like

Hello for .count error: Cannot assign from type System.Int32 to type System.String in assign activity Assign

@Bot_Learner , if your assigning it to an array of string you can remove the count function


For getting the first file path from the array:


Hello @supermanPunch for .Any error: Cannot assign from type System.boolean to type System.String in Assign activity Assign

Variable in to is type of System.string

Hello thanks, then how to check in condition in next activity like if or path exits …to verify file exist

Just like how @supermanPunch has mentioned .any function will give you boolean value. Using that, you can determine if it exists.

1 Like