Skip to content

Commit 91c3f1f

Browse files
adding some new categories
1 parent 7a3b855 commit 91c3f1f

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

Organise-Directory-Files.py

+17-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
dir_path = os.path.dirname(os.path.realpath(__file__))
55

66
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]")
88
for filename in os.listdir(dir_path):
99
# Check if files are images and you can add more extentions
1010
if filename.lower().endswith((".png", ".jpg", ".jpeg", ".gif", ".bmp", ".pbm", ".pnm")):
@@ -24,14 +24,14 @@
2424

2525
# Check if files are videos and you can add more extentions
2626
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")
3131
os.remove(filename)
3232

3333
# Check if files are executables
34-
if filename.lower().endswith((".exe", ".msi", ".deb")):
34+
if filename.lower().endswith((".exe", ".msi", ".deb" , "dmg")):
3535
# If executables folder doesnt exist then create
3636
if not os.path.exists("executables"):
3737
os.makedirs("executables")
@@ -40,7 +40,7 @@
4040

4141
# Check if files are archive files
4242
if filename.lower().endswith((".rar", ".tar" , ".zip" , ".gz")):
43-
# If executables folder doesnt exist then create
43+
# If archive folder doesnt exist then create
4444
if not os.path.exists("archives"):
4545
os.makedirs("archives")
4646
shutil.copy2(filename, "archives")
@@ -49,15 +49,15 @@
4949

5050
# Check if files are torrent files
5151
if filename.lower().endswith((".torrent",)):
52-
# If executables folder doesnt exist then create
52+
# If torrent folder doesnt exist then create
5353
if not os.path.exists("torrent"):
5454
os.makedirs("torrent")
5555
shutil.copy2(filename, "torrent")
5656
os.remove(filename)
5757

5858
# Check if files are documents
5959
if filename.lower().endswith((".txt", ".pdf", ".docx" , "doc")):
60-
# If executables folder doesnt exist then create
60+
# If documents folder doesnt exist then create
6161
if not os.path.exists("documents"):
6262
os.makedirs("documents")
6363
shutil.copy2(filename, "documents")
@@ -66,12 +66,19 @@
6666

6767
# Check if files are code files
6868
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
7070
if not os.path.exists("code"):
7171
os.makedirs("code")
7272
shutil.copy2(filename, "code")
7373
os.remove(filename)
7474

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)
7582

7683
except OSError:
7784
print("Error happened ...... try again")

0 commit comments

Comments
 (0)