A smart document organization tool that automatically sorts your documents into categorized folders based on filenames. The program learns from your choices and maintains consistent folder structures across different locations.
- Automatically sorts documents (PDF, JPG, PNG, JPEG) into categorized folders
- Extracts document types from filenames
- Creates year-based subfolders automatically (e.g., 2024, 2023) based on dates in filenames
- Maintains consistent folder numbering (e.g., 01_Vertrag, 02_Information)
- Learns from your categorization choices
- Remembers document types for each category
- Stores learning data in a
.pdf_sorter_knowledge.jsonfile - Option to store learning data locally or in cloud storage
- Works with major cloud storage providers:
- iCloud Drive
- Google Drive
- Dropbox
- OneDrive
- Handles cloud sync states and ensures files are fully downloaded
- Maintains consistent folder structure across different locations
- Detects personal names in filenames
- Handles various date formats
- Maintains consistent folder naming conventions
- Automatically numbers folders (01_, 02_, etc.)
- Automatically creates category folders from learning data
- Renames existing folders to match learned structure
- Creates year subfolders as needed
- Preserves existing files during folder reorganization
python >= 3.6
PyPDF2
scikit-learn
numpy
- Clone or download this repository
- Install the required packages:
pip install -r requirements.txt- Run the program:
python pdf_sorter.py-
Enter the path to your documents folder when prompted
- For cloud storage, use the full path
- For iCloud:
/Users/username/Library/Mobile Documents/com~apple~CloudDocs/your/folder - For local folders:
/path/to/your/documents
-
The program will:
- Create or sync folder structure
- Process each document
- Ask for categorization when unsure
- Create year subfolders as needed
- Move files to appropriate locations
-
After processing one folder, you can choose to:
- Process another folder
- Exit the program
Documents/
├── 01_Vertrag/
│ ├── 2024/
│ │ └── 20240316_contract.pdf
│ └── 2023/
│ └── 20230515_agreement.pdf
├── 02_Information/
│ └── 2024/
│ └── 20240112_info.pdf
└── 03_Rechnung/
├── 2024/
│ └── 20240201_invoice.pdf
└── other_invoice.pdf
- The program stores learning data in
.pdf_sorter_knowledge.json - You can choose to store this file:
- In your cloud storage (for sync across devices)
- In your local user directory
- In a different cloud storage location
-
Cloud Storage
- Ensure folders are synced locally before processing
- The program will wait for files to finish downloading
- Use "Copy as Pathname" from Finder for accurate paths
-
Naming Conventions
- Include dates in YYYYMMDD format for automatic year sorting
- Use descriptive names for better categorization
- Separate words with underscores or spaces
-
Categories
- Categories are automatically numbered (01_, 02_, etc.)
- Existing folders will be renamed to match the structure
- Empty folders will be created for known categories
The program handles various scenarios:
- Cloud sync issues
- Permission problems
- Invalid paths
- File access errors
- Folder creation/renaming issues
- The program preserves existing files during folder reorganization
- Year subfolders are only created when needed
- Learning data can be shared across different folders
- The program maintains consistent structure across all locations