Remove some characters from the name of excel file

I have a excel file name abc_AM.xlsx.
I wish to change the file name to abc_AM.xlsx or abc_PM.xlsx based on time.
How can we do it?
abc_AM.xlsx (14.8 KB)

Use the Move File activity to copy it to a new filename, and then delete the old file.

To get AM or PM you use Now.ToString(“tt”)

But I have the file name abc_AM
I have to remove _AM and add _PM at its place based on time
I have added the excel file also for the reference

Is there any code by which we can remove _AM from the file name
and just keep it as abc.xlsx

Assign filename = “abc_AM.xlsx”


Hello @Kunal_Jain

You can use replace method to replace the required value. Sample post below.
Another method is using the Move file activity and in the destination provide the same path with required file name.


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