-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
28 lines (24 loc) · 882 Bytes
/
app.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
# practice path and libraries. will use pathlib module
from pathlib import Path
dir_name = input("Input the name of the directory that you want to create: ")
path = Path(dir_name)
response = input(f"Create '{dir_name}' folder? (Y/N): ")
if response.upper() == "Y":
if not path.exists():
path.mkdir()
print(f"Created the '{dir_name}' folder.")
else:
print(f"{dir_name} folder already exists")
response = input(f"Delete '{dir_name}' folder? (Y/N): ")
if response.upper() == "Y":
if path.exists():
path.rmdir()
print(f"Removed the '{dir_name}' folder.")
else:
print(f"'{dir_name}' folder does not exists")
else:
print(f"Did not delete the {dir_name} folder.")
print("Printing out the files in the current directory: ")
path = Path()
for file in path.glob("*"):
print(file)