Date Folder Creation Inside Output folder

Does anybody know how can i create the date folder inside the output folder of the robot, i am able to create the logs/Data Folder seperately but i want to create a date wise folder inside the logs folder to keep track of execution log on daily basis can anybody help me with this.
image

Checked documentation and seems this is not supported out of box. But made small test based on this info and seems creating a bat(I’m on win) file and running it gave result.
robot.yaml:

tasks:
  Run all tasks:
    shell: test.bat

condaConfigFile: conda.yaml
artifactsDir: output
PATH:
  - .
  - resources
PYTHONPATH:
  - .
ignoreFiles:
  - .gitignore

bat file contains one line

python -m robot --report NONE --outputdir output\\logs_%date:~7,2%%date:~4,2%%date:~12,2% --logtitle "Task log" tasks.robot
1 Like

Hi,

This is one of those things that I would recommend what @linkraivo is suggesting.
Bringing the full shell resolution support to robot.yaml is kind of breaking it’s main purpose, which is predictability. For example while you can easily divert the outputs dynamically, other tools that want to use your outputs suddenly need to “know your logic” for the relocation.

What I like about the example Raivo gives is that making a script is a very conscience choice, that the developer makes to get a dynamic thing to happen. This is also a point where you’d need to take the maintenance responsibility,(does work cross-platform? does it need to? etc…).

So the developer in me says let’s definitely add it there, but the maintainer me is pulling the reigns HARD and asking to stop and thing :wink:

The bigger question though is why?
Storing files locally and assuming they stay there is one of the causes of brittle bots and a LOT of maintenance work. If the files are important, pushing them out as results to system or locations that are maintained is the preferred option. If they are intermittent files for debugging then Raivo’s example is the way to go. Combined with a second script that does cleanups.

Question like:
Who cleans up those files?
What if there are collisions?
How does the end-user find the correct file after a week?
…end-up costing a lot of maintenance time down the line.

The summary is that we have kept these out for a reason so far.
A convention that allows everything is not a convention… but we’ve been wrong many a time, so if you have a wider use case to put some more force behind this need; we will definitely take a look.

BR, Kari

2 Likes