1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| 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, "")
|
|