Hey guys
I researched this problem here on the forum but I couldn’t find a solution.
it turns out that in the if activity, in “else” the robot apparently has difficulty reading.
quickly explaining, i did a test that it will read a pdf by name inside a folder. he read correctly, oh well.
however when you don’t have the pdf, it should return “doesn’t exist” as shown below.
Does anyone know why he is not returning the “doesn’t exist”
lakshman
(Ganta lakshman)
2
@Guilherme_Silva
Can you show us screenshot of available files in that folder.
1 Like
Then,
in the folder does not have files
I left it without files only to fall into the registry “does not exist”
however, the robot runs and ends up without the “does not exist” log
lakshman
(Ganta lakshman)
4
@Guilherme_Silva
If input folder is empty then it won’t go inside For Each loop only. Because of that you are not seeing doesn’t exist message here.
1 Like
sorry, in my reasoning
I thought that if the folder did not have the file “test uipath.pdf”
he was going to return that it doesn’t exist, because it doesn’t really exist.
In this case, how would I be able to return that the file “test uipath.pdf” does not exist
lakshman
(Ganta lakshman)
6
@Guilherme_Silva
Let’s say input folder contains 3 files with below names.
- RPA test uipath.pdf → exist
- Automation test uipath.pdf → exist
- Hyper automation file.pdf → no exist
If you want to print no exist then file name should not contain test uipath.pdf
1 Like
Yoichi
(Yoichi)
7
Hi,
Perhaps, you should use the following condition with out ForEach.
System.IO.Directory.GetFiles(folder).Any(Function(f) System.IO.Path.GetFileName(f).Contains("test uipath.pdf"))
Regards,
1 Like
kmisko11
(Kamil)
8
Hi @Guilherme_Silva,
I think you can also write something like that:
Directory.GetFiles(“FolderPathToSearch”,“pattern/file name”).ToList.Counts>0 to check if there is any file that meets your requirements.
You can use any pattern you want like “uipath” etc.
Best Regards,
Kamil
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.