Skip to content

Commit 12bce02

Browse files
authored
Update Main.py
1 parent 61dc3f5 commit 12bce02

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

File_Manager/Main.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
22

3-
43
# get all list of correct directory
54
list_dir = os.listdir(".")
5+
list_dir =[each.upper() for each in list_dir]
6+
if len(list_dir) == 1:
7+
print("This folder looks like Empty")
68

79
ext_file = []
810
folder_name = []
@@ -13,14 +15,14 @@
1315
# check is file or dir
1416
if os.path.isfile(i):
1517
# if equal to script name skip
16-
if i == 'Main.py' or i == "File Magager.exe":
18+
if i == 'Main.py' or i == "File-Manager.exe":
1719
continue
1820
# # split file name to catch extension name
19-
false_temp , temp = i.split('.')
21+
temp = i.split('.')
2022
# append extension of file to ext_file list
21-
ext_file.append(temp)
23+
ext_file.append(temp[-1])
2224
# set folder status to 0
23-
created_folder[temp] = 0
25+
created_folder[temp[-1]] = 0
2426
else:
2527
list_dir.remove(i)
2628

@@ -40,6 +42,6 @@
4042
temp = each.split(".")
4143
# if file is create while program run or
4244
# create not folder to file name skip it
43-
if temp[1] not in ext_file:
45+
if temp[-1] not in ext_file:
4446
continue
45-
os.rename(each,f"./{temp[1]}_files/{each}")
47+
os.rename(each,f"./{temp[-1]}_files/{each}")

0 commit comments

Comments
 (0)