Use variable in file directory path

Hi,

I am trying to open a file directory path where a variable is embedded in the path.

e.g Using variable PriorReportMonth with variable value as September 2018

File directory: Directory.GetFiles(“H:\Documents\UiPath\RD_Web_Access”,“470000 - Income Received in Advance- +PriorReportMonth.xlsm”)

With UiPath the intention is to pick up the file 470000 - Income Received in Advance- September 2018 given that I have specified I am looking for September 2018 from my variable value.

I don’t think I’ve quite got it right as yet. Any assistance would be greatly appreciated.

Regards,

Jeff

@JeffNZ

Directory.Getfile will expect a folder path, when you give a folder path then it will return array of file path that exists inside that folder.

In your case you are giving file path instead of folder path which is wrong, try giving folder path.

Hi,

Thanks for your prompt response.

I tried to specify the file path without using directory.getfile and I get an error: “Value of type string cannot be converted to '1-dimensional array of string”. What am I doing wrong here?

Regards,

Jeff

FileList2 is not a array, its a string

Try changing the data type to array of string, string