How to rename a dynamic excel workbook every day?

There is a daily, dynamic excel workbook that changes its name each day based on the date (For example, the format is) → Daily Report 10112022.xlsx

I simply want to change the name of this report to “Data.xlsx” every day and overwrite the old “Data.xlsx” file. This file will stay within the same exact file path as well. I’ve tried the Move File activity with no luck. This is my logic:

I start with an Assign activity (image above). I create a variable (strToday) which = DateTime.Now.ToString(MMddyyyy) to mimic the data convention of “Daily Report 10112022.xlsx”.

image

I then use the “Move File” Activity (image above). In the FROM box, I use the old file path, strToday, and an “" to account for extra text (for example) → “C:\Report Folder\Daily Report” + strToday + "” and in the TO box I use the same file path with the rename I want (for example) → “C:\Report Folder\Data.xlsx”

Yet, when I run this bot, I receive the following error (below)

image

I’m assuming the illegal character is the “*”. but how else to I account for a dynamic excel workbook that changes names every day? Please help!

you have to use it like

From
"C:\Report Folder\Daily Report " + strToday.Trim + ".xlsx"
To
"C:\Report Folder\Data.xlsx"

For name containing * you can use strToday.Replace(“*”," ").ToString

HI @contractRPA

You can try with for each file in folder
image

Regards
Sudharsan