-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathorganizer.py
More file actions
49 lines (42 loc) · 1.6 KB
/
organizer.py
File metadata and controls
49 lines (42 loc) · 1.6 KB
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
import shutil,os,glob
#intro
print("_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|\n___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__")
print(" FILE ORGANIZER ")
print(" ~By Ashish ")
print("_|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|\n___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__")
os.system("pause")
# Copying Files
def copy(newpath,file):
if not os.path.exists(newpath):
os.makedirs(newpath)
shutil.copy(file, newpath)
os.remove(file)
# Creating Folders
def folder(extension,fname):
lists=glob.glob(extension)
# print(lists)
for name in lists:
if name=="organizer.py":
print(name)
continue
copy(fname,name)
#Sorting Files
folder("*.py","Python Scripts")
folder("*.java","Java Codes")
folder("*.c","C Codes")
folder("*.html","HTML")
folder("*.cpp","C++ Files")
folder("*.mp3","Music")
folder("*.mp4","Videos")
folder("*.txt","Documents/Text Files")
folder("*.docx","Documents/Word Files")
folder("*.xlsx","Documents/Excel Sheets")
folder("*.pptx","Documents/PowerPoint Presentations")
folder("*.pdf","Documents/PDF Files")
images=["*.jp*","*.png","*.psd","*.bmp"]
for img in images:
folder(img,"Images")
# for filename in glob.glob("*.*"):
# os.rename(filename, filename.replace(" ", ""))
# os.rename(filename, filename.replace("_", ""))
# os.rename(filename, filename.replace("-", ""))