I would like the script to create a new directory based on the given directories with the same name already in place. Such that if Folder 0 exists, but Folder 1 does not, it creates Folder 1 and stops at one directory creation.
import os
i=1
while True:
path = "Folder_{}/".format(i)
os.makedirs(os.path.dirname("Folder_{}/".format(i)), exist_ok=False)
if not os.path.exists(path):
os.makedirs(os.path.dirname("Folder_{}/".format(i)), exist_ok=False)
i += 1
I have tested the above code, and it has quite given me the headache as it creates around 10K directories/second haha. Thanks in advance!
while:causes a syntax error.