-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGrouper.py
More file actions
72 lines (61 loc) · 2.86 KB
/
Grouper.py
File metadata and controls
72 lines (61 loc) · 2.86 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import os
def logo():
print('''
▄████ ██▀███ ▒█████ █ ██ ██▓███ ▓█████ ██▀███
██▒ ▀█▒▓██ ▒ ██▒▒██▒ ██▒ ██ ▓██▒▓██░ ██▒▓█ ▀ ▓██ ▒ ██▒
▒██░▄▄▄░▓██ ░▄█ ▒▒██░ ██▒▓██ ▒██░▓██░ ██▓▒▒███ ▓██ ░▄█ ▒
░▓█ ██▓▒██▀▀█▄ ▒██ ██░▓▓█ ░██░▒██▄█▓▒ ▒▒▓█ ▄ ▒██▀▀█▄
░▒▓███▀▒░██▓ ▒██▒░ ████▓▒░▒▒█████▓ ▒██▒ ░ ░░▒████▒░██▓ ▒██▒
░▒ ▒ ░ ▒▓ ░▒▓░░ ▒░▒░▒░ ░▒▓▒ ▒ ▒ ▒▓▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░
░ ░ ░▒ ░ ▒░ ░ ▒ ▒░ ░░▒░ ░ ░ ░▒ ░ ░ ░ ░ ░▒ ░ ▒░
░ ░ ░ ░░ ░ ░ ░ ░ ▒ ░░░ ░ ░ ░░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░
''')
cwdir = os.getcwd()
print("\nCWD : {}\n".format(cwdir))
_, _, filenames = next(os.walk(cwdir))
ignore_file = []
while True:
os.system("cls")
logo()
print("| 1 | Ignore files with extension")
if len(ignore_file) > 0:
print("\tignore Files : ",ignore_file)
print("\n| [ Enter ] To Start Grouping |")
command = input("\n? ")
if command == '1':
os.system("cls")
logo()
print("\nEnter file Extensions\n\nExample :\n\tmkv\n\tmp3\n\tmp4\n\tpng")
print("\npress 0 to stop")
file = None
while(file!='0'):
file = input("\n:")
if file == '0':
break
if file != '':
ignore_file.append(file)
elif command == "":
break
else:
continue
os.system("cls")
logo()
for i in filenames:
a = i.split(".")
try :
try: # Make Folder If not their
if a[-1] not in ignore_file:
b = "{}\\".format(cwdir)
path = os.path.join(b,a[-1])
os.makedirs(path)
print("$ Folder Created : ",a[-1])
finally: # replace File Place To Correct Folder
if a[-1] not in ignore_file:
if a[0] != "Grouper":
c_file_place = os.path.join(cwdir,"{}.{}".format(".".join(a[:-1]),a[-1]))
new_file_place = os.path.join(cwdir,"{}\\{}.{}".format(a[-1],".".join(a[:-1]),a[-1]))
os.rename(c_file_place,new_file_place)
except Exception as e:
pass
input("\n\n\nPress Enter To Exit : ")