File path

How to get file location from its file name.
Thanks in advance

Hi @guptasweb

To get the files try with

Directory.GetFiles("Your folder path")

To get all the files in the subfolder

Directory.GetFiles(Environment.CurrentDirectory+"\Input\Banking Files\","*.*",SearchOption.AllDirectories)

Get File count


Get File Name

Path.GetFileName("Your folderpath")

Get Filename without Extension

Path.GetFileNameWithoutExtension("Your folderpath")

Get all Directories from the folder



I want the location of a file not the file name i.e path

Check it out @guptasweb


Hello @guptasweb ,

I tend to believe that Path.GetDirectoryName is the method you are looking for. It returns the directory information for the specified path.

For more details, please refer to

Best regards,

1 Like

As I dont have path so what should I write after path.GetDirectoryName ?

Hi @guptasweb ,

In your case, what is the data you are aware of? What do you know?


I have only file name


How do you manage to get the filename? Are you using some method? a loop somewhere?

Best regards,


These are the methods you can implement in UiPath. But there is no specific activity to get filepath through name

That code developed by my colleague I want to do some changes and, in that code, I’m facing such issue did not find a file when it ran, and he did not remember the location.

@guptasweb ,

What kind of filepath do you have within your project? Are you using absolute file path? Could you please share a print screen of the sequence you are trying to fix it?

Please refer to this article to know about what I’m talking about.

Best regards,