How to rename a downloaded file. File downloaded has no specific name

Hello all,

In my sequence I download excel file from website. Name of excel file is not static. It keeps on changing.
I want to rename this file.
downloaded file can have name like:


I want to change file name to “BOT_input.xls”

Why my post is withdrawn

If you want the file to be renamed and to be in the same folder you can use Move function, if different folder you can use copy file activity with different filename.

Note: There is Move File Activity as well, you don’t have to use Invoke Method


Yes but the catch here is I cannot specify the name of file that need to be renamed. coz at every download name of file changes.

How many files will you be having the the download folder at a given time?

If one, then just pick that and get the filename using Directory.GetFiles(@“YOUR PATH”)

If multiple, you can get most recent file DirectoryInfo(@“YOUR PATH”).GetFiles().OrderByDescending(Function(x) x.LastWriteTime)


Yeah one file at a time…

Then use this Path.GetFileName(“your path”)

1 Like

Hi I am using “DirectoryInfo(@“YOUR PATH”).GetFiles().OrderByDescending(Function(x) x.LastWriteTime)” coz I may have multiple files in future but this gives error.

Thankyou so much @vvaidya … really appreciate your help. KUDOS

Hi vvaidya,

in the below function, what is Function(x) x.?

DirectoryInfo(@“YOUR PATH”).GetFiles().OrderByDescending(Function(x) x.LastWriteTime)

Could you please explain as I am getting the error while executing.