Skip to content

Commit 43b0115

Browse files
code formatting updated
1 parent 1ea4953 commit 43b0115

File tree

3 files changed

+153
-77
lines changed

3 files changed

+153
-77
lines changed

FileMover.py

Lines changed: 62 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''Python program to move file from one folder to another folder.
1+
"""Python program to move file from one folder to another folder.
22
@author : CodePerfectPLus
33
@language : Python 3
44
Website : http://codeperfectplus.github.io/
@@ -9,57 +9,87 @@
99
/ /___ / /_/ // /_/ // __/ / ____// __// / / __// __// /__ / /_ / ____// // /_/ /(__ )
1010
\____/ \____/ \__,_/ \___/ /_/ \___//_/ /_/ \___/ \___/ \__/ /_/ /_/ \__,_//____/
1111
12-
'''
12+
"""
1313
import os
1414
from os import path
1515
from shutil import move
1616

17-
paths = ['Programing File',
18-
'Compressed',
19-
'Application',
20-
'Picture',
21-
'Video',
22-
'Documents',
23-
'Music',
24-
'CodePerfectPlus']
17+
paths = [
18+
"Programing File",
19+
"Compressed",
20+
"Application",
21+
"Picture",
22+
"Video",
23+
"Documents",
24+
"Music",
25+
"CodePerfectPlus",
26+
]
2527
for root in paths:
26-
try:
27-
os.mkdir(root)
28-
except OSError as error:
29-
print('Folder Already Exists')
30-
31-
pic = ['.jpeg','.jpg','.png','.gif','.tiff','.raw']
32-
pytho =['.ipynb','.java','.cs','.js']
33-
txt = ['.txt','.pdf','.doc', '.pdf', '.ppt', '.pps', '.docx', '.pptx']
34-
music = [ '.mp3', '.wav', '.wma', '.mpa', '.ram', '.ra', '.aac', '.aif', '.m4a', '.tsa']
35-
zip = ['.zip', '.rar', '.arj', '.gz', '.sit', '.sitx', '.sea', '.ace', '.bz2', '.7z']
36-
app = ['.exe','.msi']
37-
vid = ['.mp4','.webm','.mkv','.MPG', '.MP2', '.MPEG', '.MPE', '.MPV', '.OGG', '.M4P', '.M4V',
38-
'.WMV', '.MOV', '.QT', '.FLV', '.SWF','.AVCHD','.avi', '.mpg', '.mpe', '.mpeg', '.asf', '.wmv', '.mov', '.qt', '.rm']
28+
try:
29+
os.mkdir(root)
30+
except OSError as error:
31+
print("Folder Already Exists")
32+
33+
pic = [".jpeg", ".jpg", ".png", ".gif", ".tiff", ".raw"]
34+
pytho = [".ipynb", ".java", ".cs", ".js"]
35+
txt = [".txt", ".pdf", ".doc", ".pdf", ".ppt", ".pps", ".docx", ".pptx"]
36+
music = [".mp3", ".wav", ".wma", ".mpa", ".ram", ".ra", ".aac", ".aif", ".m4a", ".tsa"]
37+
zip = [".zip", ".rar", ".arj", ".gz", ".sit", ".sitx", ".sea", ".ace", ".bz2", ".7z"]
38+
app = [".exe", ".msi"]
39+
vid = [
40+
".mp4",
41+
".webm",
42+
".mkv",
43+
".MPG",
44+
".MP2",
45+
".MPEG",
46+
".MPE",
47+
".MPV",
48+
".OGG",
49+
".M4P",
50+
".M4V",
51+
".WMV",
52+
".MOV",
53+
".QT",
54+
".FLV",
55+
".SWF",
56+
".AVCHD",
57+
".avi",
58+
".mpg",
59+
".mpe",
60+
".mpeg",
61+
".asf",
62+
".wmv",
63+
".mov",
64+
".qt",
65+
".rm",
66+
]
67+
3968

4069
def start():
4170
for f in os.listdir():
42-
name , ex = path.splitext(f)
71+
name, ex = path.splitext(f)
4372
for i in range(len(pic)):
4473
if ex == pic[i]:
45-
move(f,'Picture')
74+
move(f, "Picture")
4675
for i in range(len(vid)):
4776
if ex == vid[i]:
48-
move(f,'Video')
77+
move(f, "Video")
4978
for i in range(len(pytho)):
5079
if ex == pytho[i]:
51-
move(f,'Programing File')
80+
move(f, "Programing File")
5281
for i in range(len(txt)):
5382
if ex == txt[i]:
54-
move(f,'Documents')
83+
move(f, "Documents")
5584
for i in range(len(music)):
5685
if ex == music[i]:
57-
move(f,'Music')
86+
move(f, "Music")
5887
for i in range(len(app)):
5988
if ex == app[i]:
60-
move(f,'Application')
89+
move(f, "Application")
6190
for i in range(len(zip)):
6291
if ex == zip[i]:
63-
move(f,'Compressed')
64-
start()
92+
move(f, "Compressed")
6593

94+
95+
start()

FileMoverGUI.py

Lines changed: 90 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''Python program to move file from one folder to another folder.
1+
"""Python program to move file from one folder to another folder.
22
@author : CodePerfectPLus
33
@language : Python 3
44
Website : http://codeperfectplus.github.io/
@@ -9,82 +9,128 @@
99
/ /___ / /_/ // /_/ // __/ / ____// __// / / __// __// /__ / /_ / ____// // /_/ /(__ )
1010
\____/ \____/ \__,_/ \___/ /_/ \___//_/ /_/ \___/ \___/ \__/ /_/ /_/ \__,_//____/
1111
12-
'''
12+
"""
1313
import os
1414
from os import path
1515
from shutil import move
1616
import tkinter as tk
1717

1818

1919
def create_folder():
20-
paths = ['Programing File',
21-
'Compressed',
22-
'Application',
23-
'Picture',
24-
'Video',
25-
'Documents',
26-
'Music',
27-
'CodePerfectPlus']
20+
paths = [
21+
"Programing File",
22+
"Compressed",
23+
"Application",
24+
"Picture",
25+
"Video",
26+
"Documents",
27+
"Music",
28+
"CodePerfectPlus",
29+
]
2830
for root in paths:
29-
try:
30-
os.mkdir(root)
31-
except OSError as error:
32-
print('Folder Already Exists')
33-
pic = ['.jpeg','.jpg','.png','.gif','.tiff','.raw']
34-
pytho =['.ipynb','.java','.cs','.js']
35-
txt = ['.txt','.pdf','.doc', '.pdf', '.ppt', '.pps', '.docx', '.pptx']
36-
music = [ '.mp3', '.wav', '.wma', '.mpa', '.ram', '.ra', '.aac', '.aif', '.m4a', '.tsa']
37-
zips = ['.zip', '.rar', '.arj', '.gz', '.sit', '.sitx', '.sea', '.ace', '.bz2', '.7z']
38-
app = ['.exe','.msi']
39-
vid = ['.mp4','.webm','.mkv','.MPG', '.MP2', '.MPEG', '.MPE', '.MPV', '.OGG', '.M4P', '.M4V',
40-
'.WMV', '.MOV', '.QT', '.FLV', '.SWF','.AVCHD','.avi', '.mpg', '.mpe', '.mpeg', '.asf', '.wmv', '.mov', '.qt', '.rm']
31+
try:
32+
os.mkdir(root)
33+
except OSError as error:
34+
print("Folder Already Exists")
35+
36+
37+
pic = [".jpeg", ".jpg", ".png", ".gif", ".tiff", ".raw"]
38+
pytho = [".ipynb", ".java", ".cs", ".js"]
39+
txt = [".txt", ".pdf", ".doc", ".pdf", ".ppt", ".pps", ".docx", ".pptx"]
40+
music = [".mp3", ".wav", ".wma", ".mpa", ".ram", ".ra", ".aac", ".aif", ".m4a", ".tsa"]
41+
zips = [".zip", ".rar", ".arj", ".gz", ".sit", ".sitx", ".sea", ".ace", ".bz2", ".7z"]
42+
app = [".exe", ".msi"]
43+
vid = [
44+
".mp4",
45+
".webm",
46+
".mkv",
47+
".MPG",
48+
".MP2",
49+
".MPEG",
50+
".MPE",
51+
".MPV",
52+
".OGG",
53+
".M4P",
54+
".M4V",
55+
".WMV",
56+
".MOV",
57+
".QT",
58+
".FLV",
59+
".SWF",
60+
".AVCHD",
61+
".avi",
62+
".mpg",
63+
".mpe",
64+
".mpeg",
65+
".asf",
66+
".wmv",
67+
".mov",
68+
".qt",
69+
".rm",
70+
]
71+
4172

4273
def start():
4374
for f in os.listdir():
44-
name , ex = path.splitext(f)
75+
name, ex = path.splitext(f)
4576
for i in range(len(pic)):
4677
if ex == pic[i]:
47-
move(f,'Picture')
78+
move(f, "Picture")
4879
for i in range(len(vid)):
4980
if ex == vid[i]:
50-
move(f,'Video')
81+
move(f, "Video")
5182
for i in range(len(pytho)):
5283
if ex == pytho[i]:
53-
move(f,'Programing File')
84+
move(f, "Programing File")
5485
for i in range(len(txt)):
5586
if ex == txt[i]:
56-
move(f,'Documents')
87+
move(f, "Documents")
5788
for i in range(len(music)):
5889
if ex == music[i]:
59-
move(f,'Music')
90+
move(f, "Music")
6091
for i in range(len(app)):
6192
if ex == app[i]:
62-
move(f,'Application')
93+
move(f, "Application")
6394
for i in range(len(zips)):
6495
if ex == zips[i]:
65-
move(f,'Compressed')
96+
move(f, "Compressed")
6697

6798

68-
# Gui
69-
effects=tk.GROOVE
99+
# Gui
100+
effects = tk.GROOVE
70101

71102
window = tk.Tk()
72103

73-
frame_a = tk.Frame(master=window,width=80,relief=effects,borderwidth=5)
74-
frame_b = tk.Frame(master=window,width=80,relief=effects,borderwidth=5)
104+
frame_a = tk.Frame(master=window, width=80, relief=effects, borderwidth=5)
105+
frame_b = tk.Frame(master=window, width=80, relief=effects, borderwidth=5)
75106

76-
frame_a.grid(row =1, column=1)
77-
frame_b.grid(row=2,column=1)
107+
frame_a.grid(row=1, column=1)
108+
frame_b.grid(row=2, column=1)
78109

79-
window.rowconfigure(2,minsize=300,weight=1)
80-
window.columnconfigure(1,minsize=300,weight=1)
110+
window.rowconfigure(2, minsize=300, weight=1)
111+
window.columnconfigure(1, minsize=300, weight=1)
81112

82113

83-
btn = tk.Button(master=frame_a,text='Create Folder',command=create_folder,bg='green',width=20,height=5)
84-
btn2 = tk.Button(master=frame_b,text='Move Now',command=start,bg='red',width=20,height=5)
85-
lbl = tk.Label(master=window,text='Warning \n First Create Folder Then Click On Move',fg='red',bg='black',width=50)
114+
btn = tk.Button(
115+
master=frame_a,
116+
text="Create Folder",
117+
command=create_folder,
118+
bg="green",
119+
width=20,
120+
height=5,
121+
)
122+
btn2 = tk.Button(
123+
master=frame_b, text="Move Now", command=start, bg="red", width=20, height=5
124+
)
125+
lbl = tk.Label(
126+
master=window,
127+
text="Warning \n First Create Folder Then Click On Move",
128+
fg="red",
129+
bg="black",
130+
width=50,
131+
)
86132

87-
lbl.grid(row=0,column=1)
88-
btn.grid(row=1,column=0)
89-
btn2.grid(row=1,column=1)
133+
lbl.grid(row=0, column=1)
134+
btn.grid(row=1, column=0)
135+
btn2.grid(row=1, column=1)
90136
window.mainloop()

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
theme: jekyll-theme-architect
1+
theme: jekyll - theme - architect

0 commit comments

Comments
 (0)