FREE PYTHON PROJECT
Sort PDF Files Automatically with Python
If your Downloads folder contains a mix of invoices, reports, contracts and offers, this Python script can organize them into named folders. It searches PDF filenames for keywords and moves the files, without opening or reading their contents.
PythonGitHub source codeHands-on tutorial
How it works
- Scan the PDF files directly inside the configured input folder.
- Match invoice/Rechnung, contract/Vertrag, offer/Angebot, CV or report keywords.
- Move each PDF into the corresponding folder under Sorted_PDFs.
- Append a numeric suffix when a destination filename already exists.
What you'll learn
You will learn file automation, filename matching, folder creation and safe handling of duplicate filenames. Important: The project moves files, so start with a test folder.
How to run it
Download the repository and run python3 pdf_sorter.py in the project folder (on Windows, py pdf_sorter.py). You can edit the SOURCE, RULES and DESTINATION values before running.
The linked repository contains the complete README and current source files.