How to convert System.IO.FileInfo into String?

Hi,
i’m building a logic which has to take the name of the newly downloaded file for future usage, in other automations in UiPath. For this purpouse i wanted to receive at the end of flow the output with the downloaded file name as a variable. To use that i inserted all the logic in the scope of activity ,Wait for Download" and as output i set my variable name. Unfortunately this output variable is in System.IO.FileInfo data type so I cannot use it in next steps of automation like, openinng this file and etc.

Can anyone help me to convert System.IO.FileInfo datatype into String?

Or there’s maybe some other, better solution to get the name or path for newly downloaded file?

@Mateusz_Piotrowski

May be this example will help you.
You can also customize your file searching pattern like this
Directory.GetFiles(“Your File Path”, “.”, SearchOption.AllDirectories).Where(Function(s) s.EndsWith(".pdf") Or s.EndsWith(".docx"))

GetFiles.xaml (5.4 KB)

1 Like

Thank you a lot for response anandji05 :slight_smile: I’ve already managed with my problem by exeprimenting. So, after I get in output object data of downloaded file (by usage ,Wait for download" acitivity) i use ,Assign" activitiy and asssigned new variable(string) to objectdata.Name

Assign activitiy after ,Wait for download" acitivity:

Newvariable = Outputobject.Name

Like in the picture:

Thanks a lot!

:+1:

In the Downloaded File you reference “FOfile”. Did you have to declare “FOfile” as a variable above in order to use it and how did you do that?