A small, self-contained local web app for rapidly previewing, renaming, and sorting PDF files.
Open a folder of PDFs in your browser, review them one-by-one with a full PDF preview, rename files, move them into folders (including custom nested folders), and work efficiently using keyboard shortcuts.
No cloud services. No uploads. Files never leave your machine.
- Inline PDF preview using a local PDF.js viewer (same-origin)
- Rename PDFs in place
- Move PDFs to:
- preset folders
- arbitrary custom folders (nested folders supported)
- Persistent recent-folder chips
- remembered across restarts
- one-click fill for fast filing
- Keyboard-driven workflow
- Safe trash (moves files into
_trash/, no deletion) - Local-only execution
- binds to
127.0.0.1 - no network access required after first run
- binds to
- Python 3.9+
- A modern browser (Chrome, Firefox, Edge, Safari)
Python dependency:
- flask
git clone https://github.com/akiscode/pdf-sorter.git
cd pdf-sorterOr download pdf_sorter.py directly.
pip install flask or
python3 -m pip install flaskpython pdf_sorter.py /path/to/your/pdf/folderExample (Windows / PowerShell):
python .\pdf_sorter.py "$env:USERPROFILE\Desktop\pdfs"Example (macOS / Linux):
python pdf_sorter.py ~/Desktop/pdfshttp://127.0.0.1:5055
| Key | Action |
|---|---|
| j / → | Next PDF |
| k / ← | Previous PDF |
| r | Focus rename box |
| m | Focus move-folder box |
| Enter | Submit focused form |
Shortcuts are ignored while typing in input fields.
- Press
r - Type the new filename
- Press
Enter
.pdf is automatically appended if missing.
Files can be moved in two ways.
Choose a destination from the dropdown and click Move.
Type any folder path relative to the root folder:
Invoices/2025
Reports/Quarterly
Scans/Archive
Folders are created automatically if they do not exist.
- Every successful move adds the destination to Recent folders
- Chips persist across restarts in
_recent_folders.json - Clicking a chip fills the move box (does not auto-move)
- Use Clear recents to reset the list
Click Trash to move the file into:
<root folder>/_trash/
Files are never permanently deleted.
python pdf_sorter.py <folder> [options]| Option | Description |
|---|---|
| --port 5055 | Port to run on |
| --host 127.0.0.1 | Host (local-only by default) |
| --dests "_sorted,_keep,_review" | Preset destination folders |
Example:
python pdf_sorter.py ~/Desktop/pdfs --dests "_sorted,Invoices,Reports,Archive"| File / Folder | Purpose |
|---|---|
| _pdfjs/ | Local PDF.js viewer (auto-downloaded) |
| _recent_folders.json | Persistent recent-folder list |
| _trash/ | Safe trash folder |
All files are created next to pdf_sorter.py.
- Files are never uploaded
- The app binds to
127.0.0.1by default - All paths are sanitized
- Destination folders are restricted to the chosen root directory
- Folder scanning is non-recursive by design
- Only PDF files are shown
- Single-user, single-folder workflow
- Auto-advance after rename or move
- One-click chip auto-move
- Undo last move
- Optional recursive mode
- OCR-based filename suggestions
Pull requests welcome.
MIT License.
This tool was built to quickly sort large, unstructured collections of PDF documents where traditional file-manager workflows are slow or error-prone.
If it is useful to you, that is the goal.