tree = { "document" : { "protokol" : "template.xlce", "tech": { } }, "Zeichnung" : None, "video": None } from pathlib import Path import sys tree = [ "document/protokoll/", "document/tech", "Zeichnung/", "video" ] def mkdir_struct(tree, prefix="./"): parent = Path(prefix) if parent.is_dir(): for p in tree: directory = parent.joinpath(p) directory.mkdir(parents=True, exist_ok=True) else: print(f"{prefix} ist kein Ordner oder existiert nicht") prefix = sys.argv[1] mkdir_struct(tree, prefix) tree2 = [ "photos/urlaub", "photos/screenshots", "bluetooth/" ] mkdir_struct(tree2, "")