How to check if the file exists in folder without passing file extension(PDF, Doc, Docx)

studio
uipath
#1

Type of reusable component:

Question:

Current Behavior:

Expected Behavior:

Studio/Robot/Orchestrator Version:

I need to send mail by adding attachment which are present in folder.

First, I need to read data from one folder there I get attachment filename with extension and then I need to search in Attachments folder whether the file exists or not. If Exists I need to attach that attachment and send mail.

**Main.xaml (9.7 KB)
** I need to search weather the file exists in folder with passing the file extension (.pdf, .doc, .docx).

#2
string[] files = System.IO.Directory.GetFiles(path, "filename.*");
if (files.Length > 0)
{
    //file exist
}
1 Like
#3

I have tried but it didn’t worked can you please update my solution and post it.

#4

Did you got any error ?
I don’t see any issue with the code.
can you try hard coding the values of path and file name and check.
If it works, then you are passing the wrong values in the variables.

#5

Hey Thank you for your support. It works fine. @KarthikByggari

1 Like