└── Main /Main: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | DOWNLOAD_FOLDER = "C:/Users/YourUsername/Downloads" 5 | FILE_TYPES = { 6 | "Images": [".jpg", ".jpeg", ".png", ".gif"], 7 | "Documents": [".pdf", ".docx", ".txt"], 8 | "Videos": [".mp4", ".mkv"], 9 | "Archives": [".zip", ".rar"] 10 | } 11 | 12 | def organize_files(): 13 | for file in os.listdir(DOWNLOAD_FOLDER): 14 | file_path = os.path.join(DOWNLOAD_FOLDER, file) 15 | if os.path.isfile(file_path): 16 | for category, extensions in FILE_TYPES.items(): 17 | if any(file.endswith(ext) for ext in extensions): 18 | folder_path = os.path.join(DOWNLOAD_FOLDER, category) 19 | os.makedirs(folder_path, exist_ok=True) 20 | shutil.move(file_path, os.path.join(folder_path, file)) 21 | print(f"Moved {file} to {category}") 22 | 23 | if __name__ == "__main__": 24 | organize_files() 25 | --------------------------------------------------------------------------------