-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfolders.py
160 lines (62 loc) · 2.6 KB
/
folders.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import os
import argparse
dlpath = "C:\\Users\\GSoukup\\Downloads"
os.chdir(dlpath)
parser = argparse.ArgumentParser(description='Processes the folder name from CLI. (i.e: W380923)',add_help=True, epilog='The actual script helps you create daily folders.\nIf you do NOT provide a folder name with -n optional NAME argument than you are asked to provide one. \n If you are using -n flag you can instantly provide the folder name.\n \n After creating folders, you can always decide to delete them if you have mistaken.\n')
parser.add_argument('-n',default='-', help="This is the foldername.")
args = parser.parse_args()
directory = args.n
print(f'The following argument given: {directory}\n')
"""
def makeDirs(name):
name = input('Please provide a folder name:')
os.mkdir()
"""
# Creating folder
parentDir = os.getcwd()
if directory == "-":
directory = input('Please provide a folder name.\n')
path = os.path.join(parentDir,directory)
# Creating subfolders
issues,pstrmps,potig,remedy = "issues","pstrmps","potig","remedy"
pathissues = os.path.join(path,issues)
pathpstrmps = os.path.join(path,pstrmps)
pathpotig = os.path.join(path,potig)
pathremedy = os.path.join(path,remedy)
# Already existing?
if os.path.exists(path):
os.rmdir(pathissues)
os.rmdir(pathpstrmps)
os.rmdir(pathpotig)
os.rmdir(pathremedy)
os.rmdir(path)
print(f"\nEmpty folder ({directory}) deleted with the same name at the following path: {path}\n")
input("Please approve.\n\n")
print(f"Current folder path:\n {path}\n")
# Making folders
os.mkdir(path)
print(f"Folder is created > '{directory}' at '{parentDir}'\n\n")
os.mkdir(pathissues)
print(f"Folder is created > '{issues}' at ''{path}'\n")
os.mkdir(pathpstrmps)
print(f"Folder is created > '{pstrmps}' at '{path}'\n")
os.mkdir(pathpotig)
print(f"Folder is created > '{potig}' at '{path}'\n")
os.mkdir(pathremedy)
print(f"Folder is created > '{remedy}' at '{path}'\n")
# Deleting subfolder, folders
wannaDel = input("\nPlease input you want to delete the new folder or not. y/n \n")
print(f"\nAnswered: '{wannaDel}' which is {type(wannaDel)}\n")
if wannaDel == "y":
os.rmdir(pathissues)
print(f"Folder '{pathissues}' is deleted.\n")
os.rmdir(pathpstrmps)
print(f"Folder '{pathpstrmps}' is deleted.\n")
os.rmdir(pathpotig)
print(f"Folder '{pathpotig}' is deleted.\n")
os.rmdir(pathremedy)
print(f"Folder '{pathremedy}' is deleted.\n")
os.rmdir(path)
print(f"Folder '{path}' is deleted.\n")
else:
print("Folder(s) is/are NOT deleted.\n")