Ping_Pong
(Ping_Pong)
1
Hi, I am using Invoke Code method to rename a file
Old file:C:\Users"+system.Environment.UserName+“\Downloads\widget.csv
Newfile:C:\Users"+system.Environment.UserName+”\Downloads\Widget_(date)_2021.csv
At the position of date(string), I have to dynamically rename the file.
Any help to rename the file. Thanks in advance.
Hi,
Use move file activity to rename your file dynamically no need to go for invoke code. please find the below screenshot for your reference.

parameteres:
From: “C:\Users”+system.Environment.UserName+“\Downloads\widget.csv”
To: “C:\Users”+system.Environment.UserName+“\Downloads\Widget_”+now.tostring(“dd_mm_yyyy”)+“.csv”
let me know if it works for you. thanks.
Regards,
Kirankumar.
Ping_Pong
(Ping_Pong)
3
Hi @kirankumar.mahanthi1
Thanks for the reply I already have the date as a string (str_inputDate).
How can I write in the new file Default?
please replace now.tostring(“dd_mm_yyyy”) with your variable str_inputDate( i hope your dynamically getting this value) and try .
To: “C:\Users”+system.Environment.UserName+“\Downloads\Widget_”+str_inputDate+“.csv”
Ping_Pong
(Ping_Pong)
5
It’s helping.Thanks, @kirankumar.mahanthi1