hss
(hss)
September 11, 2019, 5:51am
1
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.
AshwinS2
(Ashwin S)
September 11, 2019, 6:11am
2
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 ")…
amaresan
(Amaran)
September 11, 2019, 7:10am
5
@hss
Use below code
**Directory.GetFiles(“C:\Documents\UipathBot\ExcelFiles”,"*ABC.xlsx")
divyagupt
(Divya Gupta)
September 11, 2019, 7:18am
6
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.
hss
(hss)
September 11, 2019, 8:01am
7
thanks @amaresan it worked for me…
hss
(hss)
September 11, 2019, 8:04am
8
thanks @divyagupt it gave me a broader sense, to go forward with all files.
system
(system)
Closed
September 14, 2019, 8:05am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.