Create folder on new year

Hi Guys,

I want to create one folder only when its new year and then inside it need to create subfolders from excel, how i can do it ?

1 Like

Hi
Can I have an example pls
@amruta_pawar

1 Like

yeah means if year is 2020 then folder should get created as 2020 on jan 2021 if bot get run it will check for 2021 folder if folder not exsist then it will create 2021

Fine
For current month and year if we want to first check for the folder availability and based on that if we want to create the folder these steps would help you resolve this
—use a PATH EXISTS activity where mention the path And get the Boolean variable as output named bool_output
—then use a IF activity where mention as
bool_output = True
If true it will go to Then or goes to ELSE part
In ELSE part use CREATE DIRECTORY activity where mention the folder path like this
“Yourfolderpath\”+Now.ToString(“yyyy”)

Cheers @amruta_pawar

HI,
Create two variables with datetime varDat1 & varDat2 and in varDat1 get currentDate using now.ToString(“yyyy”) and varDat2 as now.AddDays(-1).ToString(“yyyy”)

  1. So in Variable varDat1 you get current date (only year) and in VarDat2 you get yesterday date year.
  2. Then compare using if condition “not varDat1.Equals(varDat2)” then you can create the folder using create Folder Activity. how this logic works means if current Date is jan1/2021 then you get in VarDat1 “2021” and varDat2 “2020” so if comparison you can create.

Hope you understand i think.

Hi can you please guide for path exsist i mean what should i write in path? as we have to cehck for year folder exsist or not.

Same as this

Cheers @amruta_pawar

2 Likes

thank you it worked

1 Like

Cheers @amruta_pawar

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