File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
3
-
4
3
# get all list of correct directory
5
4
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" )
6
8
7
9
ext_file = []
8
10
folder_name = []
13
15
# check is file or dir
14
16
if os .path .isfile (i ):
15
17
# 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" :
17
19
continue
18
20
# # split file name to catch extension name
19
- false_temp , temp = i .split ('.' )
21
+ temp = i .split ('.' )
20
22
# append extension of file to ext_file list
21
- ext_file .append (temp )
23
+ ext_file .append (temp [ - 1 ] )
22
24
# set folder status to 0
23
- created_folder [temp ] = 0
25
+ created_folder [temp [ - 1 ] ] = 0
24
26
else :
25
27
list_dir .remove (i )
26
28
40
42
temp = each .split ("." )
41
43
# if file is create while program run or
42
44
# create not folder to file name skip it
43
- if temp [1 ] not in ext_file :
45
+ if temp [- 1 ] not in ext_file :
44
46
continue
45
- os .rename (each ,f"./{ temp [1 ]} _files/{ each } " )
47
+ os .rename (each ,f"./{ temp [- 1 ]} _files/{ each } " )
You can’t perform that action at this time.
0 commit comments