Skip to content

Commit 7b49f73

Browse files
authored
Update Main.py
1 parent d19bcce commit 7b49f73

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

File_Manager/Main.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22

3-
# get all list of correct directory
43
list_dir = os.listdir(".")
54
list_dir =[each.upper() for each in list_dir]
65
if len(list_dir) == 1:
@@ -10,38 +9,24 @@
109
folder_name = []
1110
created_folder= {}
1211

13-
# add all file extensions to list
1412
for i in list_dir:
15-
# check is file or dir
1613
if os.path.isfile(i):
17-
# if equal to script name skip
1814
if i == 'Main.py' or i == "File-Manager.exe":
1915
continue
20-
# # split file name to catch extension name
2116
temp = i.split('.')
22-
# append extension of file to ext_file list
2317
ext_file.append(temp[-1])
24-
# set folder status to 0
2518
created_folder[temp[-1]] = 0
2619
else:
2720
list_dir.remove(i)
2821

29-
# create folder for each type
3022
for i in ext_file:
31-
# check if folder create status is false
3223
if created_folder[i] == 0:
33-
# added folder created name to folder_name list
3424
folder_name.append(f"{i}_files")
35-
# create folder
3625
os.mkdir(f"{i}_files")
37-
# set status of folder created to 1
3826
created_folder[i] = 1
3927

40-
# move files to each folder
4128
for each in list_dir:
4229
temp = each.split(".")
43-
# if file is create while program run or
44-
# create not folder to file name skip it
4530
if temp[-1] not in ext_file:
4631
continue
4732
os.rename(each,f"./{temp[-1]}_files/{each}")

0 commit comments

Comments
 (0)