Lets say I have a program that will run every 3 months, I want it to create a new folder with the name 2022Quarter1
. Then when I run it again 3 months later, I want it to say 2022Quarter2
, etc. Then when a new year comes in, that new year first quarter will be called 2023Quarter1
, and so on.
I wrote this part of the program, just so I have an idea of what I want my end goal to be:
import os
for i in range(4):
i+=1
num=i
try:
os.makedirs(f'C:/users/desktop/quarters/{yearNum}Quarter{num}')
except FileExistsError:
# directory already exists
pass