Directory, with a variable folder

Hello people.

I need what
the robot saves files in a specific directory.

however, a portion of this directory changes depending on the month it is in. example if we are in the month of january need to continue the path in the folder 01, february 02 and so on
image

how can I get the robot to identify the correct month number and continue with the rest of the directory?

To identify the current month, I’m using the variable: datetime.now.adddays (-now.day) .tostring (“MM”). to sequence

which pulls only the current month (01,02,03,04).

would anyone know how? I searched and found no answers

Hi @rogerio

Can you use switch expression give the now.tostring(“MM”)
Case Jan
Assign directory.getfiles("path of folder’)
Likewise do it for other month

Thanks
Ashwin.s

1 Like

hello sorry i didn’t understand.

in this case you would need the robot to identify the current month, along with the directory and proceed to save the file.

example: "C: \ user \ documents \ CURRENT MES() \ folder2 \ folder3

Hi @rogerio
U can try this to get the current month

Now.ToString(“MM”)

Using that specify in the directory while searching for folder (before that use Path Exists activity to check whther that folder exists or not)

Regards,
Nived N

Hi ,
If I understand correct, You can do like this -
Path.combine(“c:\user\documents”,Current Month extracted( e.g 02),“folder2\folder3”)