|
4 | 4 | dir_path = os.path.dirname(os.path.realpath(__file__))
|
5 | 5 |
|
6 | 6 | try:
|
7 |
| - print("Organising your files intro [ images - music - video -executable - archive - torrent - document - code ]") |
| 7 | + print("Organising your files intro [ images - music - video -executable - archive - torrent - document - code - design files]") |
8 | 8 | for filename in os.listdir(dir_path):
|
9 | 9 | # Check if files are images and you can add more extentions
|
10 | 10 | if filename.lower().endswith((".png", ".jpg", ".jpeg", ".gif", ".bmp", ".pbm", ".pnm")):
|
|
24 | 24 |
|
25 | 25 | # Check if files are videos and you can add more extentions
|
26 | 26 | if filename.lower().endswith((".webm", ".mp4")):
|
27 |
| - # If music folder doesnt exist then create |
28 |
| - if not os.path.exists("music"): |
29 |
| - os.makedirs("music") |
30 |
| - shutil.copy2(filename, "music") |
| 27 | + # If video folder doesnt exist then create |
| 28 | + if not os.path.exists("video"): |
| 29 | + os.makedirs("video") |
| 30 | + shutil.copy2(filename, "video") |
31 | 31 | os.remove(filename)
|
32 | 32 |
|
33 | 33 | # Check if files are executables
|
34 |
| - if filename.lower().endswith((".exe", ".msi", ".deb")): |
| 34 | + if filename.lower().endswith((".exe", ".msi", ".deb" , "dmg")): |
35 | 35 | # If executables folder doesnt exist then create
|
36 | 36 | if not os.path.exists("executables"):
|
37 | 37 | os.makedirs("executables")
|
|
40 | 40 |
|
41 | 41 | # Check if files are archive files
|
42 | 42 | if filename.lower().endswith((".rar", ".tar" , ".zip" , ".gz")):
|
43 |
| - # If executables folder doesnt exist then create |
| 43 | + # If archive folder doesnt exist then create |
44 | 44 | if not os.path.exists("archives"):
|
45 | 45 | os.makedirs("archives")
|
46 | 46 | shutil.copy2(filename, "archives")
|
|
49 | 49 |
|
50 | 50 | # Check if files are torrent files
|
51 | 51 | if filename.lower().endswith((".torrent",)):
|
52 |
| - # If executables folder doesnt exist then create |
| 52 | + # If torrent folder doesnt exist then create |
53 | 53 | if not os.path.exists("torrent"):
|
54 | 54 | os.makedirs("torrent")
|
55 | 55 | shutil.copy2(filename, "torrent")
|
56 | 56 | os.remove(filename)
|
57 | 57 |
|
58 | 58 | # Check if files are documents
|
59 | 59 | if filename.lower().endswith((".txt", ".pdf", ".docx" , "doc")):
|
60 |
| - # If executables folder doesnt exist then create |
| 60 | + # If documents folder doesnt exist then create |
61 | 61 | if not os.path.exists("documents"):
|
62 | 62 | os.makedirs("documents")
|
63 | 63 | shutil.copy2(filename, "documents")
|
|
66 | 66 |
|
67 | 67 | # Check if files are code files
|
68 | 68 | if filename.lower().endswith((".py", ".php", ".html" , ".css" , ".js")):
|
69 |
| - # If executables folder doesnt exist then create |
| 69 | + # If code folder doesnt exist then create |
70 | 70 | if not os.path.exists("code"):
|
71 | 71 | os.makedirs("code")
|
72 | 72 | shutil.copy2(filename, "code")
|
73 | 73 | os.remove(filename)
|
74 | 74 |
|
| 75 | + # Check if files are design files |
| 76 | + if filename.lower().endswith((".psd", ".ai")): |
| 77 | + # If desgin folder doesnt exist then create |
| 78 | + if not os.path.exists("design-files"): |
| 79 | + os.makedirs("design-files") |
| 80 | + shutil.copy2(filename, "design-files") |
| 81 | + os.remove(filename) |
75 | 82 |
|
76 | 83 | except OSError:
|
77 | 84 | print("Error happened ...... try again")
|
|
0 commit comments