Create a new folder with current date

Hi everyone, I am relatively new to both UIPath and coding so this may be really simple for the average user.

What I need to do is create a new folder in a specific path named with current date in the format “yyyy-mm-dd”. I know “Create directory” is the way to go, but I cannot get it to have the current name as its name (I am trying with variables, but no success so far)

Any help? Thank you very much!

2 Likes

@AntonioM87 - Please refer to the below post. It has an example xaml file too.

Thanks for your quick reply. I download the file but it does not seem to work for me. Or probably I cannot extract the specific actions I need to be performed.

Sorry!

Datetime.today.tostring(yyyy-MM-dd)
Small mm is minutes @AntonioM87

Thank you, but could you be more specific?

I mean, where do I have to insert “Datetime.today.tostring(yyyy-MM-dd)”?

That is the name of your folder.
You can add this in thé activity create directory.
Path=“c:\”+datetime…

1 Like

Not working. I am using this sting in the Expression editor:

"C:\Users\Windows\Downloads"+“Datetime.today.tostring(yyyy-MM-dd)”

However, a folder with the name “Datetime.today.tostring(yyyy-MM-dd)” is created. What am I doing wrong?

Add \ between
download and datetime
and no quotes around datetime statement

Trying with

"C:\Users\Windows\Downloads"+Datetime.today.tostring(yyyy-MM-dd)

but a Validation error is returned:

The workflow has validation errors. Review and resolve them first.

Compiler error(s) encountered processing expression "“C:\Users\Windows\Downloads"+Datetime.today.tostring(yyyy-MM-dd)”.
‘yyyy’ is not declared. It may be inaccessible due to its protection level.
‘MM’ is not declared. It may be inaccessible due to its protection level.
‘dd’ is not declared. It may be inaccessible due to its protection level.

"C:\Users\Windows\Downloads\”+Datetime.today.tostring(“yyyy-MM-dd”)

6 Likes

Yeees! Great, thank you a lot :slight_smile:

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