Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def create_new_dir(self, prefix="./", root="Sims"):
"""
Create the directory where to put the simulation
"""
self.dirRoot = os.path.join(prefix, root)
today = datetime.date.today()
free = False
index = 0
dirDate = today.strftime("%d-%m-%Y")
dirComp = os.path.join(self.dirRoot, dirDate)
dir = os.path.join(dirComp, "Sim_" + str(index))
while not free :
if os.path.exists(dir):
index = index + 1
simNum = "Sim_" + str(index)
dir = os.path.join(dirComp, simNum )
else:
free = True
os.makedirs(dir)
return dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.