Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment