Rename File and Filename should contain current date and time

I am automating one Monitoring task. Whenever monitoring task gets completed, one Excel file is sent to the client. This Excel File’s name must contains the current date and time.

I am copying one Excel file format and pasting to the other folder. Now this new file’s name must contain the current date and time. Ex. the name of the file should be SRM-System-Check-14-04-2017_06_54.

Please find my xaml file.

test_filename.xaml (8.8 KB)

I’m sorry what’s your question here?

1 Like

Now Please check the xaml file… I want to pass current date and time as a name of the file.

string Destination = "SRM-System-Check-" + DateTime.Now.ToString("dd-MM-yyyy_HH_mm") + ".xlsx"

Should work.
Please also check below page for more details on date->string formatting:

4 Likes

You need to set value to “dest” variable after you have initialized Filename.

or

1 Like

It is not working. I want to rename the file and File should contain current date and time

What part is not working? Please share your xaml, looks pretty straightforward. You can either hardcode the datetime as mentioned by @andrzej.kniola or you can continue as you are doing, but declare dest after you have initialized Filename.

Hi Chand,

it’s not the problem with Uipath. It is extremely with excel naming limitations.
Below is the screenshot for your reference.

To achieve your task, please do as below. First replace all un-supported characters from the date and give that name as your file name. Below is the sample artifact for this. Once you copied it to different location then move it to desired folder by using “Movefile” .

test_filename (3).xaml (9.2 KB)

Please get back to us, if it works or any challenges.

Thanks,
Rahul

3 Likes

Thank you it worked :slight_smile:

Hi ,

how to achieve this while in Save Attachment activity in Outlook.

Rgds
Aditi

I have done the dest you have mentioned here, but the actual file is not saved there or anywhere else.

Could you please assist?02a_bits-centcity.xaml (44.3 KB)

Managed to resolve this by playing around with the flow and this is the result

02a_bits-centcity.xaml (44.0 KB)

string Destination = “SRM-System-Check-” + DateTime.Now.ToString(“dd-MM-yyyy_HH_mm”) + “.xlsx”

This example worked for me also…