This is a rough and hacky script that looks into the first page of PDF files to figure out what they are, and propose (or applies) a new name to them based on their content.
As this is aimed at my (@Flameeyes) own use, the list of supported PDFs pretty much focuses on bills and statements from UK, Italian, or Irish services and banks.
- American Express UK
- Microsoft Azure
- Invoices
- Chase
- Digikey
- Invoices
- eBay
- Seller Statements (Detailed and Summarized)
- EDF Energy
- Bills
- ENEL Energia
- FinecoBank
- UK Bank Statements
- Google Cloud
- Invoices (European)
- London Borough of Hounslow
- Council Tax Bills
- Hyperoptic
- Bills (templates from 2017 to 2020)
- KBC Ireland
- Statements ca. 2015
- Lloyds
- M & S Bank
- Mouser
- Invoices
- NatWest Group
- NatWest
- Statements
- Statements of Fees
- Certificate of Interest
- Ulster Bank NI
- Statements
- Statements of Fees
- Certificate of Interest (Untested)
- NatWest
- NewDay Cards
- Amazon Platinum MasterCard Statements
- Nutmeg
- Suitability Reports
- O2 UK
- Bills
- Octopus Energy
- Santander UK
- Select Current Account Statements
- 1|2|3 Current Account Statements
- Statements of Fees
- Credit Card Statements
- Credit Card Annual Statements
- Scaleway
- Tested with English invoices only.
- So Energy
- Statement
- Final Bill
- Annual Summary
- Thames Water
- Bills
- Payment Plans
- Letters
- Tesco Bank
- TSB Statements
- Veritas
- Bills
- Vodafone UK
- Bills
Set up the virtual environment as follows. Select the script for bash (Linux, OSX, etc.) or Windows PowerShell (especially for Visual Studio Code).
$ python -m venv venv
$ . venv/bin/activate # bash
$ venv\Scripts\activate.ps1 # Windows PowerShell
(venv) $ pip install -e .
Once the venv is activated and the dependencies installed, you can run the script from the directory and point it to one or more PDFs:
# Only prints suggested renames
(venv) $ pdfrename unsortedbill.pdf
# Actually rename files
(venv) $ pdfrename --rename unsortedbill.pdf
# Verifies names
(venv) $ pdfrename --list-all "2155-10-28 - AWS - Neo - Bill.pdf"