-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorganize_directory.py
58 lines (47 loc) · 1.73 KB
/
organize_directory.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
import os
import shutil
current_dir = os.path.dirname(os.path.realpath(__file__))
print('Welcome in organize.py scripts - happy clean folder')
for filename in os.listdir(current_dir):
## organize images into Images folder
if filename.endswith((".png",".jpg",".jpeg",".gif")):
if not os.path.exists("Images"):
os.mkdir('Images')
shutil.copy(filename,"Images")
os.remove(filename)
print('Images Done')
## organize codes files into Codes folder
if filename.endswith((".css",".html",".js","bash")):
if not os.path.exists("Codes"):
os.mkdir('Codes')
shutil.copy(filename,"Codes")
os.remove(filename)
print('Codes Done')
## organize video files into Videos folder
if filename.endswith((".mp4",".webm")):
if not os.path.exists("Videos"):
os.mkdir('Videos')
shutil.copy(filename,"Videos")
os.remove(filename)
print('Videos Done')
## organize docs files into Documentes folder
if filename.endswith((".pdf",".word")):
if not os.path.exists("Docs"):
os.mkdir('Docs')
shutil.copy(filename,"Docs")
os.remove(filename)
print('Documentes Done')
## organize archive files into Archives folder
if filename.endswith((".pdf",".word",".tar")):
if not os.path.exists("Archives"):
os.mkdir('Archives')
shutil.copy(filename,"Archives")
os.remove(filename)
print('Archives Done')
## organize apps files into Apps folder
if filename.endswith((".dmg",".exe")):
if not os.path.exists("Apps"):
os.mkdir('Apps')
shutil.copy(filename,"Apps")
os.remove(filename)
print('Apps Done')