Hello !
I have a file which gets download in default folder and i need to check if file exists or not.
FileName as : “Report_of_DSCL_20345234.xlsx” , Report_of_DSCL_ this value is constant and follows random number.
How can i use File Exists using wild card.?
Yoichi
(Yoichi)
2
HI,
Can you try to use GetFiles method instead of FileExists, as the following?
files = System.IO.Directory.GetFiles("Download path","Report_of_DSCL_*.xlsx")
Regards,
1 Like
Hi @prabin_chand1
You can use the following RegEx pattern to determine the same:
Report_of_DSCL_\d+.xlsx
System.Text.RegularExpressions.Regex.Match(filePath, "Report_of_DSCL_\d+\.xlsx").Value
Hope this helps,
Best Regards.
1 Like
Gokul001
(Gokul Balaji)
4
Hi @prabin_chand1
You can try with Regular Expression
System.Text.RegularExpressions.Regex.IsMatch("C:\Users\DELL\Documents\UiPath\Test\Report_of_DSCL_20345234.xlsx","Report_of_DSCL_")

Regards
Gokul
2 Likes
HI @prabin_chand1
Try this in if Condition
Directory.GetFiles("Folder Path","Report_of_DSCL_*.xlsx").Count>0
Regards
Sudharsan
1 Like
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.