Hi all,
Software export 2 file:
ARR013_yyyyMMddhhmm_USD.xlsx.xlsx (want get)
ARR013_yyyyMMddhhmm(.)_USD.xlsx.xlsx (no)
I assigned it as below but not correct. How can I get the correct file?
Directory.GetFiles(“D:\RPA\UiPath\ACC\ARR File"+DateTime.Now.ToString(“yyyyMMdd”)+”",“ARR013_*_USD.xls.xlsx”)
Parvathy
(PS Parvathy)
August 24, 2023, 1:56am
2
Hi @anh.nguyen
Try this:
Directory.GetFiles("D:\RPA\UiPath\ACC\ARR File\" + DateTime.Now.ToString("yyyyMMdd"), "ARR013_*_USD.xlsx.xlsx")
This should match files with names like “ARR013_yyyyMMddhhmm_USD.xlsx.xlsx” as you mentioned you want, and exclude files with “ARR013_yyyyMMddhhmm(.)_USD.xlsx.xlsx” as you mentioned you don’t want. Just make sure you replace “yyyyMMdd” with the actual values you need to match the desired timestamp format.
Hope it helps!!
Parvathy
(PS Parvathy)
August 24, 2023, 2:01am
4
@anh.nguyen
Give the write line acitivty inside the for each loop and pass the item in that. Check whether it’s getting printed.
Regards
Parvathy
(PS Parvathy)
August 24, 2023, 2:09am
6
@anh.nguyen
Try this:
Directory.GetFiles("D:\RPA\UiPath\ACC\ARR File\" + DateTime.Now.ToString("yyyyMMdd"), "ARR013_*_USD.xls.xlsx")
Regards
1 Like
May be use RegularExpression
Directory.GetFiles("D:\RPA\UiPath\ACC\ARR File" + DateTime.Now.ToString(“yyyyMMdd”))
System.Text.RegularExpressions.Regex.IsMatch(currentItem,“ARR013_[0-9]{12}_USD.xls.xlsx”)
1 Like
system
(system)
Closed
August 27, 2023, 2:26am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.