A Python script that automatically organizes files into folders based on their file extensions.
This script simplifies file management by automatically sorting files in a specified directory into organized folders. It categorizes files such as images, documents, software, and archives, creating a clean and structured file system. This helps to reduce clutter and improve workflow efficiency.
- Automatic File Sorting: Organizes files based on their extensions.
- Customizable Folders: Defines folder names and corresponding file extensions in a dictionary.
- Directory Creation: Automatically creates necessary folders if they don't exist.
- Efficient File Movement: Uses
shutil.move()for fast and reliable file transfers. - Clear Output: Prints messages indicating which files have been moved and where.
- Python 3.x installed on your system.
-
Clone the repository to your local machine:
git clone https://github.com/haelahpx/FileCategorizer.git
-
Navigate to the project directory:
cd FileCategorizer
-
Modify the
source_foldervariable: Open the Python script and change thesource_foldervariable to the path of the directory you want to organize.source_folder = r"C:\Users\user\Downloads" # Example
-
Customize the
extension_mapdictionary (optional): Modify theextension_mapdictionary to add, remove, or change folder names and file extensions.extension_map = { "Images": [".jpg", ".png", ".gif"], "Documents": [".pdf", ".docx", ".xlsx", ".pptx"], # ... your custom mappings }
-
Run the script:
python your_script_name.py
Replace
your_script_name.pywith the actual name of your Python file. -
The script will create folders (if needed) and move files accordingly, printing messages to the console.
