Wild Card in UiPath

Hi,

I want to access excel files with names like 00932-ABC.xlsx and 0443_DEC.xlsx.
the numbers, dash(-) and underscore(_) are not same for all filenames…

In assign activity, i wrote - filename = Directory.GetFiles(“C:\Documents\UipathBot\ExcelFiles”,"[0-9][-|_]ABC.xlsx")

But it shows error saying illegal characters in path. What to do? Pls help.

hi @hss
use is match activity and pass the input along with pattern and then use filename assign and pass the variable and check

Thanks
Ashwin S

hey,
check your string literals(" and ")…

@hss

Use below code

**Directory.GetFiles(“C:\Documents\UipathBot\ExcelFiles”,"*ABC.xlsx")

Hello @hss
The Directory.GetFiles return an array of fileNames. Store these fileNames in an array of string. Then use For Each activity on this array and use IsMatch activity to match the file Name with regular expression. The regular expression pattern should be [0-9]+[-|_][A-Z]+.xlsx
Please see the screenshot below.
image

thanks @amaresan it worked for me… :slight_smile:

thanks @divyagupt it gave me a broader sense, to go forward with all files. :slight_smile:

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