Skip to content

Commit db9674d

Browse files
Fixed a bug with casing - thanks to sergiopjf
Can't believe I couldn't think of such a common bug. :(
1 parent 7f63a76 commit db9674d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fileSort.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import shutil
22
import os
33
from time import sleep
4-
from fileExtensions import commonFileTypes
54
import customtkinter as ctk
5+
from fileExtensions import commonFileTypes
66
from tkinter import filedialog
77
from tkinter import messagebox
88

9+
910
ctk.set_appearance_mode("dark")
1011
ctk.set_default_color_theme("dark-blue")
1112
window = ctk.CTk()
@@ -18,7 +19,7 @@ def createFolder(parent_dir):
1819
global dir_list
1920
dir_list = os.listdir(parent_dir)
2021
for fileTypes in dir_list:
21-
fileExt = fileTypes.split(".")[-1]
22+
fileExt = fileTypes.split(".")[-1].lower()
2223
if (
2324
fileExt.lower() in commonFileTypes
2425
and os.path.exists(parent_dir + "/" + commonFileTypes[fileExt]) == False
@@ -28,7 +29,7 @@ def createFolder(parent_dir):
2829

2930
def sortFiles(parent_dir):
3031
for fileTypes in dir_list:
31-
fileExt = fileTypes.split(".")[-1]
32+
fileExt = fileTypes.split(".")[-1].lower()
3233
if fileExt.lower() in commonFileTypes:
3334
shutil.move(
3435
f"{parent_dir}/{fileTypes}",
@@ -47,7 +48,7 @@ def sortButton():
4748
else:
4849
messagebox.showwarning(
4950
"Something's wrong",
50-
"I can feel it. It was an error, you didn't specify a path.",
51+
"I can feel it. It was an error, you didn't specify a path",
5152
)
5253

5354

0 commit comments

Comments
 (0)