Dynamic File name in 'Write text File'

Hello,
I am wanting to write text file where the file name will created using an
assign Activity
filename=“C:\Users\lurowley\RPA_Workfile\Logs\logs_”+DateTime.Now.ToString(“dd/MM/yyy”)+"*.txt"
then placing that file name into **write text file Activity **


I am unsure what i am doing wrong?

you don’t need the * in the “.TXT” part

plus if the date has / in it it won’t accept it as a filename

what is the variable of inputDataTable?

Is it a datatable? As I remember that datatable can not write it to string directly.

you need to use output datatable activities convert it to string and try it again.

Change this as the following,

"C:\Users\lurowley\RPA_Workfile\Logs\logs_"+DateTime.Now.ToString("dd/MM/yyy")+".txt"

that has solved it. i normally use “dd/MM/yyyy” but totally forgot you cant use “/” in file naming convention.
i have used dd-MM-yyyy Instead.
Thank you

*and removed the . in “.txt” :wink:

1 Like

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