Remving Number Extension from a downloaded File

Hi team,
I download a file from a website to a local “downloads” folder then I move to another location after adding date time stamp. However, I still see the sequence of numbers for every download
Here is my query
(Path.Combine(in_str_InProcessFolder, fileinfo_FinelineReport.Name.Remove(fileinfo_FinelineReport.Name.Length - fileinfo_FinelineReport.Extension.Length) & “_” & Now.ToString(“MMddyyyy_HHmm”) & fileinfo_FinelineReport.Extension)) and then I get
my files like you see below.

Please let me now how to remove shaded part from my moved file.
I want my filename to look like
Order Detail _03112023_1909.xlsx


Option 1: You could rename the file first then move the file.

Option 2: Once you move all the files you could use regex to remove the brackets.

Step 1: Read all the files
Step 2: Fnsert a for each
Step 3: insert assign


System.text.regularexpressions.Regex.replace(item.ToString, “(\d)”,””)

Regex Preview

Step 4: insert a rename file activity into the for each. Update the rename file activity with:

From: item.ToString
To: strNewFileName

Hopefully this helps



Hi @Steven_McKeering

Thanks for taking the time to look into this.
I have one correction. I do not move multiple files at time, just one file at a time.
Yes, I want to rename and move, can I know how to replace\remove parenthesis and number?
for example like you see here


Take a look here:

Main.xaml (12.9 KB)




Thanks @Steven_McKeering
I have these folders that I take the file from and move to.
And here is the query I used to do that. However, I cannot remove the numbers and parenthesis.

1 Like


Okay then,

After “Assign | Set in progress file name”

Insert another assign at the yellow ‘x’. Now insert the following into the assign.

Left Assign:

Right Assign:
System.Text.RegularExpressions.Regex.Replace(out_str_FinelineReportPath,“(?<=Order Detail )(\d+)”,“”)

Let us know how you go.



1 Like

Hi @Steven_McKeering
Thanks for taking the time to help.

Here is the error message I receive.

FYI - I want the report as “Order Detail _03112023_1909.xlsx”. in the new folder. The only issue I have is the current file name comes with number of downloads (like you see in the previous screenshot, I want that part to be to be trimmed.


Hi @Steven_McKeering

I just wanted to give you additional info, if it might help. The file gets downloaded to here.

The query for the folder path is here.

Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), “Downloads”)

Question: Is there a way we can remove the download number at this stage, maybe? so that we can get only “Order Detail.xlsx” as a file name. Then, the timestamp addition will be the next step. Please let me know if you need more information. Thanks a lot!

If you are downloading via browser you can go into the download settings and tick this box

this allows you to rename the file and type in a whole pathway to save it e.g. if you type in C:\Users\NAME\Documents\filename.xlsx it will save in your documents

Hi @aquinn

Thank you for the help.
I still want it to be downloaded into the “Downloads” folder. However, I do not want to see the number of downloads added to the file name. I just need the file name alone. Could you look into that, please?

As for the download setting goes.
I see the following Msedge browser.

if you tick the ask me what to do with each download, then in the file explorer you can type in the pathway “C:\Users\sisay.dinku\Downloads\order detail.xlsx”

Hi @aquinn

Unfortunately, that led me to another additional steps. Even though I added those steps in my process. I still receive the numbers with the downloaded file names. See the screenshot. Thanks!

Use a click activity to click the downward arrow

@aquinn I did that but that did not make any changes interms of removing the number that comes with downloaded filename. Thanks a lot for your help!

Apologies use the click activity to click save as

this will bring up windows file explorer and let you type in “C:\Users\sisay.dinku\Downloads\order detail.xlsx” to save it

Hi @aquinn

How do you remove (03) from ChromeSetup (03).exe and make it ChromeSetup.exe

Use a type into activity in the search bar and type in the pathway you want - C:\Users\sisay.dinku\Downloads\order detail.xlsx

and if you need the date on it, in the pathway filed type:
“C:\Users\sisay.dinku\Downloads\order detail_”+Date.Today.tostring(“ddMMyyy”)+“.xlsx”

Hi @Steven_McKeering and team,
Here is the expression I use to download the file to “downloads” folder.
The folder location is fine, but one thing I want to be removed is the numbers that comes with the downloaded file. I do not want the number as it is not part of the file name.
For example, with this expression

Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), “Downloads”)

It downloads to the folder, but it comes like Order Detail (5).xlsx. I want only Order Detail.xlsx every time I download. Is there a way we can modify the above expression so that we can achieve what we want (we can get only the file name)? II appreciate your help. Thanks!!

@aquinn @fernando_zuluaga @Anil_G @Yoichi


I will give you an easier way…not modifying filename because why you are getting 1 2 and 3 in the filename is because there already exists a file with order Details.xlsx in the downloads folder so by default to save from conflict number is appended when auto downloading without ask for download setting on the chrome…

So before downloading the file use a File Exists activity and check for the file and if exists then use delete file activity and delete it…so that when downloaded no number will be added. Please try and let us know if any issues

Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), “Downloads”,"Order Detail.xlsx")

Hope this helps