-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup-files.py
More file actions
27 lines (17 loc) · 797 Bytes
/
cleanup-files.py
File metadata and controls
27 lines (17 loc) · 797 Bytes
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
# access to the os, file, directories
import os
# Absolute full path
# create a folder
# make_folder = os.mkdir('/Users/george.estellore.iii/Desktop/NewFolder')
try:
folder_original = ('/Users/george.estellore.iii/Desktop/')
folder_destination = ('/Users/george.estellore.iii/Desktop/CleanedUp-v2')
os.mkdir(folder_destination)
for entry in os.scandir(folder_original):
location_original = os.path.join(folder_original, entry.name)
location_destination = os.path.join(folder_destination, entry.name)
if os.path.isfile(location_original):
os.rename(location_original, location_destination)
print('Program Successfully executed')
except FileExistsError as err:
print(err, 'Directory not found! \n Please check the path')