Rename Excel File and Filename should contain current date (Format: Sep-28-2018)

I’m trying to rename an Excel File and ensure the Filename contains current date. The file’s name is MSFTSep-28-2018.xlsm , so on Sep 29, its name should be MSFTSep-29-2018.xlsm. The File Path is C:\Users\UC218177\Documents\Cross Listing\MSFTSep-28-2018.xlsm. I don’t know how to create a sequence to achieve this purpose.

Dont know if i understood it correctly but you could make a sequence that does:

  1. go to file path
  2. left-click the excel file
  3. click “rename”
  4. a type-into activity with the .Now syntax

@Yolanda Follow below link

Hi, Ibra. “left-click” can’t rename a file, and “right-click” can’t be executed in Uipath

Thanks a lot. I tried the solution, but it doesn’t work.

@Yolanda

Use Like this

strPath=Directory.GetFiles(“C:\Users\UC218177\Documents\Cross Listing”,“MSFT”+DateTime.Now.AddDays(-1).Month.ToString(“MMM”)+“-”+DateTime.Now.AddDays(-1).ToString(“dd”)+“-”+DateTime.Now.AddDays(-1).Year.ToString(“YYYY”))

Then Use Move File Activity
Give Source Path as strPath

and Give Destination File path as

“C:\Users\UC218177\Documents\Cross Listing\MSFT”+DateTime.Now.Month.ToString(“MMM”)+“-”+DateTime.Now.ToString(“dd”)+“-”+DateTime.Now.Year.ToString(“YYYY”)

Regards,
Mahesh

hi,
use
you can do it by rename work sheet activity or move file activity also

for current date use assign activity

todaysDate = System.DateTime.Now.ToString(“MM/dd/yyyy”, System.Globalization.CultureInfo.InvariantCulture)

filename = todayDate+“.txt”

regards

Aditya