A simple, fast, and customizable Command Line Interface (CLI) tool designed to automatically sort and organize files within a specified directory (like your Downloads folder) based on their file type.
- Customizable Mappings (JSON): Easily define which file extensions go into which folders by editing the
config.jsonfile. - Dry-Run Mode: Preview the organization changes before moving any files, ensuring safety and confidence in the operation.
- Typer CLI Interface: Uses the powerful Typer library for a clean, user-friendly command-line experience with automatic help generation.
- Standard Library Focus: Relies heavily on Python's built-in libraries (
pathlib,shutil) for robust and portable file operations. - 'Other' Folder Handling: Automatically moves files with unknown extensions into an
Otherfolder, preventing clutter.
You need Python 3.6+ installed on your system.
-
Clone the Repository:
git clone [https://github.com/Jedkedir/Automated-File-Organizer.git](https://github.com/Jedkedir/Automated-File-Organizer.git) cd automated-file-organizer -
Create and Activate Virtual Environment (Recommended):
python -m venv venv source venv/bin/activate # On Linux/macOS # .\venv\Scripts\activate # On Windows
-
Install Dependencies:
pip install -r requirements.txt
The default organization rules are stored in the config.json file. You can easily modify this file to customize your organization structure.
The structure is "FolderName": [".ext1", ".ext2", ...].
Example Snippet:
{
"Documents": [".pdf", ".docx", ".txt", ".csv"],
"Images": [".jpg", ".png", ".gif"],
"Other": []
}Note: Files with extensions not listed in the map will be moved to a folder named Other.
The main script is organize.py. Use the command python organize.py [OPTIONS] [TARGET_PATH]
If no path is specified, the script defaults to organizing your system's Downloads folder.
python organize.pyProvide the path to the folder you wish to clean up.
python organize.py /Users/Desktop/MessyFolderUse the --dry-run or short -d flag to see exactly what actions the script would take without actually moving any files.
python organize.py --dry-run /path/to/folderIf you want to use a rule set different from the default config.json, specify its path using the --config flag.
python organize.py --config ./my_custom_rules.json /path/to/folderTo view all available commands and options:
python organize.py --helpautomated-file-organizer/
├── .gitignore
├── README.md
├── requirements.txt
├── config.json # User-customizable mapping rules
└── organize.py # The main CLI application logic