NHoe
(Norman)
January 16, 2022, 11:05am
1
Hello everyone, I am currently struggling with a small issue that I need your help with.
I would like to check if a file is in the folder, this file has a date and time in the name, so I cannot determine this part.
In the Path Exists activity I tried Directory.GetFiles(strPathRPA, “open “+” .xlsx”).ToString but it tells me that this file does not exist.
Now the question, is it possible to check something like this without a for Each loop and if so, how?
1 Like
Yep @NHoe
You are already on the right path.
Just include the required date and time in the file name search… which is not included in the above statement.
Thanks
#nK
NHoe
(Norman)
January 16, 2022, 11:09am
3
Hi, the problem is, I only know the date, unfortunately not the time.
1 Like
Hey @NHoe
Kindly try this please Directory.GetFiles(strPathRPA, “open*.xlsx”)
*
denotes a wildcard which accepts any chars which is date time in this case.
If you want to include the date in the search you can still add it followed by a *
as time is unknown.
Thanks
#nK
NHoe
(Norman)
January 16, 2022, 11:28am
5
Thank you for the advice, I have tried that, but it does not work.
If I enter the following in the Path Exists activity, it works, but if I change it to Directory.Getfiles, it says that this file does not exist.
“C:\Test\open(2022-01-12 15-01).xlsx” = works
Directory.GetFiles(C:\Test",“open(2022-01-12 15-01).xlsx”).ToString = doesnt work
Already this puzzles me.
1 Like
Directory.GetFiles(path, "open(2022-01-12*).xlsx").Count > 0
This is working perfectly fine
I just used star wildcard in place of time.
Thanks
#nK
1 Like
@NHoe ,
Try to use this syntax: Directory.GetFiles(“C:\Test\open”+vardatevalue+".xlsx”).ToString
where vardatevalue holds the date value.
Thanks,
@90s_Developer
NHoe
(Norman)
January 16, 2022, 12:38pm
9
Now I have found out via the check that this file exists. How can I read it into the Read Range straight away?
1 Like
Hey @NHoe
Here you go…
Directory.GetFiles(path, "open(2022-01-12*).xlsx").First
Pass the above in the read range or excel app scope
Thanks
#nK