Write range file name

Hi,

I tried to specify the following as the file path in write range activity:

“Ui Path\Self-Serve Files\Self-Serve File “+Date.Now.ToString(“dd/MM/yy”)+”.xlsx”

What I am trying to achieve is to save a file called “Self-Serve File 04/04/19”. I’ve found that with the above setup UiPath creates 2 further sub folders (“Self-Serve 04” and “04”) and saves a file called “19.xlsx” in the “04” sub folder.

How can I ensure that a file called “Self-Serve File 04/04/19” will be saved in the “Self-Serve File” sub folder?

Many thanks in advance,

Jeff

1 Like

Hi @JeffNZ, how are you? Could you check this post below :

In order to ensure, you need to use File.Exists :

Check and let me know if you was able to solve your problem.

~Diego Turati

I noticed you are formatting your date with slashes, which are not applicable characters for a filename.
image

You will want to use a different character than the slash, like a dot or dash.
Now.ToString("dd-MM-yy")

Additionally, I normally recommend to put the year then month first, so when you sort the files, it sorts correctly. - unless the folder only has items for that year or month.
For example, Now.ToString("yyyy-MM-dd")
which will sort the files by year then by month when sorting alphabetically. This is optional though, and like I said depends on if the files are all in a folder for only that year or month or not. - This is also a manual process recommendation, so not specific toward robots.

Regards.

3 Likes

Hi Clayton,

Thanks for this. That solved my problem! I changed to dots and now my files are being saved in the intended folder.

Regards,

Jeff

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