-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
29 lines (25 loc) · 831 Bytes
/
main.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
import shutil
import os
from prettytable import PrettyTable
source = input("Enter the source path: ")
print("Data source: ", source)
destination = input("Enter the destination path: ")
print("Data will be copied to: ", destination)
try:
if os.path.isdir(destination):
print("Uh-oh, destination path already exists.")
else:
copy_tree = shutil.copytree(source, destination)
print(f"Directory copied to: {destination}")
file_names = []
for files in os.listdir(destination):
file_names.append(
[destination, files]
)
table = PrettyTable(
field_names=["Destination", "Files"]
)
table.add_rows(file_names)
print(table)
except:
print("Cannot process the request. Specify legal path of directory.")