Move file + add date to file

How to add date to moved file in move file activity?

Hi @Nightowl_music

Now.Date.ToString(“dd/MM/yyyy”)

@Nightowl_music

To Dest
DestPath+Now.ToString(“MM/dd/yyyy”)

@Nightowl_music

Bro add Now.ToString("dd/MM/yyyy") to the file path and before the extension.

Hope it works!!

image

Use this after moving and File is currentFile.FullName and New name is currentFile.FullName + Now.ToString

@Nightowl_music
in the “to” field
image

write

Path.Combine(Folderpath_Reclamesticker_Digid, Path.GetFileName(CurrentFile.FullName)+Now.toString("dd/MM/yyyy")+Path.GetExtension(CurrentFile.FullName))

1 Like

Hi @Nightowl_music

It’s better to rename the file using rename file activity, before and after copying the file.

Hi @Nightowl_music

Try this

CurrentFile.FullName+Now.ToString("dd/MM/yyyy")+System.IO.Path.GetExtension(CurrentFile.ToString)

Hi @Nightowl_music

First use the move file activity to move the file from source to destination folder.
After that use rename file activity to rename the moved file.

Take an assign activity → DateTime (String variable) = Now.ToString(dd\MM\yyyy)

In rename file activity give the destination file path in file field.
In the New name field give the new name, pass the DateTime variable to it.

Hope it helps!!

still not working for me…

Hi @Nightowl_music

Please find below xaml for your reference i have attached 2 methods to rename and move file

Rename Folder.zip (152.9 KB)

I hope it helps!!

@Nightowl_music

Have you tried this?

did it worked for you?

@Nightowl_music

Yes, it worked for me

@Nightowl_music

Are you tried it?

I am attached 2 methods you can try any one of it

yes, still says file already exists

@Nightowl_music
Can you show the process and error message

Move File: Het bestand bestaat.

@Nightowl_music

Can you show the workflow

Hello Nightowl,
In the Move File Activity, in the To field , write ‘destination_path+Now.ToString(“Thedate format which you want”)’. Note that the date has to be written to the File name before the Extension. For Eg.
C:\documents\UiPath\data\pdf_name_31-07-2023.pdf
Dest_path+“_”+Now.ToString(“dd-MM-yyyy”)+“.pdf”