File tree 2 files changed +55
-0
lines changed
2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+
4
+ # get all list of correct directory
5
+ list_dir = os .listdir ("." )
6
+
7
+ ext_file = []
8
+ folder_name = []
9
+ created_folder = {}
10
+
11
+ # add all file extensions to list
12
+ for i in list_dir :
13
+ # check is file or dir
14
+ if os .path .isfile (i ):
15
+ # if equal to script name skip
16
+ if i == 'temp.py' :
17
+ continue
18
+ # # split file name to catch extension name
19
+ false_temp , temp = i .split ('.' )
20
+ # append extension of file to ext_file list
21
+ ext_file .append (temp )
22
+ # set folder status to 0
23
+ created_folder [temp ] = 0
24
+
25
+ # create folder for each type
26
+ for i in ext_file :
27
+ # check if folder create status is false
28
+ if created_folder [i ] == 0 :
29
+ # added folder created name to folder_name list
30
+ folder_name .append (f"{ i } _files" )
31
+ # create folder
32
+ os .mkdir (f"{ i } _files" )
33
+ print (f"Now creating this folder = { i } " )
34
+ # set status of folder created to 1
35
+ created_folder [i ] = 1
36
+
37
+ # move files to each folder
38
+ for each in list_dir :
39
+ temp = each .split ("." )
40
+ # if file is create while program run or
41
+ # create not folder to file name skip it
42
+ if temp [1 ] not in ext_file :
43
+ continue
44
+ os .rename (each ,f"./{ temp [1 ]} _files/{ each } " )
Original file line number Diff line number Diff line change
1
+ A simple App For Manage Files
2
+
3
+
4
+ # how Work's:
5
+ git clone https://github.com/alisharifyy/Python-Less.git
6
+
7
+
8
+ cd File_Manager
9
+
10
+
11
+ python or python Main.py
You can’t perform that action at this time.
0 commit comments