Skip to content

Commit

Permalink
Fixed a bug with casing - thanks to sergiopjf
Browse files Browse the repository at this point in the history
Can't believe I couldn't think of such a common bug. :(
  • Loading branch information
HemanthTenneti committed Nov 10, 2023
1 parent 7f63a76 commit db9674d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fileSort.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import shutil
import os
from time import sleep
from fileExtensions import commonFileTypes
import customtkinter as ctk
from fileExtensions import commonFileTypes
from tkinter import filedialog
from tkinter import messagebox


ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("dark-blue")
window = ctk.CTk()
Expand All @@ -18,7 +19,7 @@ def createFolder(parent_dir):
global dir_list
dir_list = os.listdir(parent_dir)
for fileTypes in dir_list:
fileExt = fileTypes.split(".")[-1]
fileExt = fileTypes.split(".")[-1].lower()
if (
fileExt.lower() in commonFileTypes
and os.path.exists(parent_dir + "/" + commonFileTypes[fileExt]) == False
Expand All @@ -28,7 +29,7 @@ def createFolder(parent_dir):

def sortFiles(parent_dir):
for fileTypes in dir_list:
fileExt = fileTypes.split(".")[-1]
fileExt = fileTypes.split(".")[-1].lower()
if fileExt.lower() in commonFileTypes:
shutil.move(
f"{parent_dir}/{fileTypes}",
Expand All @@ -47,7 +48,7 @@ def sortButton():
else:
messagebox.showwarning(
"Something's wrong",
"I can feel it. It was an error, you didn't specify a path.",
"I can feel it. It was an error, you didn't specify a path",
)


Expand Down

0 comments on commit db9674d

Please sign in to comment.