Create new folder for results with timestamp

Is it possible to create a new folder with timestamp for result when running robot;

something like: c:\robot - d c:\Results/–

Results file can have --timestampoutputs but can I create a new folder (Res_21102000) and place the files there?

Hi Pete,

Yes you can run with something like c:\robot - d c:\Results/Res_21102000 and all the output files (xml, html etc) will be in the c:\Results/Res_21102000 folder.

I’m not sure if you need to create the folder first or if robot framework will create it, my scripts all seem to create the folder first before running robot.exe, but I also redirect the stdout of robot.exe to a robot.log file in that folder so maybe that’s why I needed to create the folder first.

Dave.

Hi Dave,

thank you for your answer. Now I see that my question was not clear :). What I need is that robot to create a folder with timestamp (e.g. “RES_24102022”) and place the files there.

So actually the problem is that is it possible to use some “date” variable to be used as folder name?

In my bat file I can create a new folder with md c:\temp%date%

Can I use this created folder somehow to place the files in it?

YES, I can add it …

This issue can be closed :slight_smile:

1 Like

Hi Pete,

Just be careful with the %date% environment variable, it often contains characters that are not filename/directory name friendly

This link might be useful for formatting the date for you.

Dave.