If activity. I can't see the result

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”

@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

@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

@Guilherme_Silva

Let’s say input folder contains 3 files with below names.

  1. RPA test uipath.pdf → exist
  2. Automation test uipath.pdf → exist
  3. Hyper automation file.pdf → no exist

If you want to print no exist then file name should not contain test uipath.pdf

1 Like

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

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. :wink:

Best Regards,
Kamil

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.