This script organizes your Downloads folder by moving files into specific subfolders based on their file types. It's designed to run once and tidy up the Downloads folder according to predefined rules.
- Moves PDF files to a
PDF
folder - Moves image files to an
Images
folder - Moves document files to a
Documents
folder - Moves video files to a
Videos
folder - Moves application files (
.app
,.dmg
,.pkg
,.zip
) to anApplications
folder - Handles file naming conflicts by appending a counter to the filename
- Uses a configuration file to define file type mappings
The script uses a configuration file (config.yaml
) to define the file type mappings. You can customize it according to your needs.
Example config.yaml
:
folders:
PDF: [".pdf"]
Images: [".png", ".jpg", ".jpeg", ".gif", ".bmp"]
Documents: [".docx", ".doc", ".txt"]
Videos: [".mp4", ".mov", ".avi"]
Applications: [".app", ".dmg", ".pkg", ".zip"]
-
Clone the repository:
git clone https://github.com/yourusername/downloads-organizer.git cd downloads-organizer
-
Create a virtual environment and activate it (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install pyyaml
-
Place the
config.yaml
file in the same directory as the script. -
Run the script:
python organize_downloads.py
The script will organize the files in your Downloads folder according to the rules specified in the config.yaml
file.
The script logs its activities, making it easier to track what files are moved and where. Logs are printed to the console.