Move file from downloads to given folder and rename

Hi all,

I have an issue with moving the file to desired folder. I downloaded file from website and want to movie to another folder with time. Please me with this

Assign downloadedFilePath = “C:\DownloadedFiles\file.pdf” ’ Replace this with the actual path of the downloaded file.

Assign newFileName = “New_File_” + Now.ToString(“yyyyMMdd_HHmmss”) + “.extension”

Assign newFilePath = Path.Combine(“C:\YourDesiredFolderPath”, newFileName)


@ramshiva_reddy Use ‘Wait for download’ activity

  1. In that activity the monitored folder by default is your Downloads folder.
  2. In the actvity make sure to add the activity that you have used to download the file (eg: click activity).
  3. In the ‘Downloaded file’ option add any name you want (eg: InputFile)
  4. You can then use the ‘Rename File’ activity to rename the file. In the ‘File’ option of the rename activity you can use InputFile.Fullname. This will give you the full path of the file. Under 'New Name ’ give your desired name.
  5. Next use the ‘Move File’ activity and give InputFile.Fullname in the ‘From’ option. Add the desired location in quotes in the ‘To’ option.

Here are the screenshots for the working.



Suitable approches:

  1. Get Latest file path from download folder and move it to another folder by move file activity.
    To get latest file:

str_filepath = Directory.GetFiles(yourfolder_path,“*.txt”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)

  1. Second is wait for download activity and moniter the folder but it sometime gives .tmp file due to incomplete file download before the activity time.

I’m getting an error as Index was out of range. Must be non-negative and less than the size of the collection.

How to solve this??


Check the extension that you given, that must be same as downloaded file extension.

Try this one in assign activity
Directory.GetFiles(folder_path,“.xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1)

@ramshiva_reddy Try @Brian_Mathew_Maben solution . It worked Perfectly for me

If there are 10 login credentials for the same URL after downloading and moving the file to the desired folder, I named it as “company_name+month+year”. I want the file to add as “company_name+month+year-1” and it should continue to 10.

@ramshiva_reddy Use a variable to hold the value and then increment it after every iteration. Then use “company_name+month-"+variable.ToString

@ramshiva_reddy so you want file name


Hello bro,

That’s right. I want in that format

1 Like

For this I suggest you to make an asset with int type and give it value 1.
Give file name during moving like this:

After moving file, increament the AssetValue and update back to Asset so it will get next time incremented value as 2 and so on

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.