|
6 | 6 | exeptions =['Download_Sorter.py'] |
7 | 7 | for path in paths: |
8 | 8 | exeptions.append(path) |
9 | | - |
10 | 9 | for path in paths: |
11 | 10 | if os.path.isdir(path)==False: |
12 | 11 | os.mkdir(path) |
13 | 12 |
|
14 | | -vExtensions = ['.mp4','.MOV','.mpx','.mpeg','.flv','MP4','webm','mov'] |
15 | | -pExtensions = ['.jpeg','.jpg','.png','.PNG','.gif','.JPG','HEIC'] |
16 | | -cExtensions = ['.zip','.rar','.7z','.tgz','.gz','bz2'] |
17 | | -coExtensions = ['.cs','.py'] |
18 | | -eExtensions = ['.exe','.msi'] |
19 | | -dExtensions = ['.pdf','.docx','.doc','.rtf','.txt','RTF'] |
20 | | -prExtensions = ['.pptx','.ppsx','.ppt'] |
21 | | -aExtensions = ['.mp3','.flv','ogg'] |
22 | | -sExtensions = ['xlsx','xlsm','xlsb','xltx','xls'] |
| 13 | +videoExtentions = ['.mp4','.MOV','.mpx','.mpeg','.flv','MP4','webm','mov'] |
| 14 | +photoExtentions = ['.jpeg','.jpg','.png','.PNG','.gif','.JPG','HEIC','.webp'] |
| 15 | +coppressedExtentions = ['.zip','.rar','.7z','.tgz','.gz','.bz2'] |
| 16 | +codexeExtentions = ['.cs','.py','.html','.css'] |
| 17 | +exeExtentions = ['.exe','.msi'] |
| 18 | +docsExtentions = ['.pdf','.docx','.doc','.rtf','.txt','RTF'] |
| 19 | +presentationExtentions = ['.pptx','.ppsx','.ppt'] |
| 20 | +audioExtentions = ['.mp3','.flv','ogg'] |
| 21 | +spreadsheetExtentions = ['xlsx','xlsm','xlsb','xltx','xls'] |
23 | 22 | everything = [x for x in os.listdir() if x not in exeptions] |
24 | 23 | print(everything) |
25 | 24 |
|
26 | 25 | for file in everything: |
27 | | - if any(c in file for c in vExtensions): |
| 26 | + if any(c in file for c in videoExtentions): |
28 | 27 | fType = 'Videos' |
29 | | - elif any(c in file for c in pExtensions): |
| 28 | + elif any(c in file for c in photoExtentions): |
30 | 29 | fType = 'Photos' |
31 | | - elif any(c in file for c in eExtensions): |
| 30 | + elif any(c in file for c in exeExtentions): |
32 | 31 | fType = 'Executables' |
33 | | - elif any(c in file for c in cExtensions): |
| 32 | + elif any(c in file for c in coppressedExtentions): |
34 | 33 | fType = 'Compressed' |
35 | | - elif any(c in file for c in dExtensions): |
| 34 | + elif any(c in file for c in docsExtentions): |
36 | 35 | fType = 'Documents' |
37 | | - elif any(c in file for c in prExtensions): |
| 36 | + elif any(c in file for c in presentationExtentions): |
38 | 37 | fType = 'Presentations' |
39 | | - elif any(c in file for c in aExtensions): |
| 38 | + elif any(c in file for c in audioExtentions): |
40 | 39 | fType = 'Audio' |
41 | | - elif any(c in file for c in coExtensions): |
| 40 | + elif any(c in file for c in codexeExtentions): |
42 | 41 | fType = 'Code' |
43 | | - elif any(c in file for c in sExtensions): |
| 42 | + elif any(c in file for c in spreadsheetExtentions): |
44 | 43 | fType = 'Spreadsheets' |
45 | 44 | else: |
46 | 45 | fType = 'Other' |
47 | 46 | print('moving - '+file+' - into '+fType) |
48 | | - os.rename(file,fType+'/'+file) |
| 47 | + os.rename(file,f'{fType}/{file}') |
49 | 48 | time.sleep(15) |
0 commit comments