Get specific files with dynamic names

I have been trying to get files in the same folder but have dynamic names.

For example, i need to get 3 pdf files from the same folder which contains “AB1C_01” as shown below.

C:\Users\CO\OM-AB1C_01-140222.pdf
C:\Users\CO\AM-AB1C_01-211022.pdf
C:\Users\CO\PM-AB1C_01-280422.pdf

Is there a way that I can get all files containing “AB1C_01”?

Thank you very much for your help in advance!

Hi,

Can you try the following expression?

files = System.IO.Directory.GetFiles("C:\Users\CO","*AB1C_01*")

note: files is String array type.

Regards,

hI @Melvin_Kwok

You can use the For each file in folder activity
image

CurrentFile.Tostring will get the file path

Regards
Sudharsan

HI @Melvin_Kwok

Welcome to Uipath community

How about this expression?

Directory.GetFiles("C:\Users\CO","*AB1C_01*")

For detail check out this tutorial

Regards
Gokul