Rename inscrutable PDFs using ollama
NO MORE 155714.pdf 155835.pdf 155956.pdf 156077.pdf 630026.pdf 155594.pdf 155715.pdf 155836.pdf 155957.pdf 156078.pdf 630028.pdf 155595.pdf 155716.pdf 155837.pdf 155958.pdf 156079.pdf
I made a quick python script that uses an LLM to rename a folder of PDFs. This is useful for when you scrape a bunch of files, but the file names are a bunch of random numbers or something like that.
It’s quick and dirty but it works reasonably well if you just need to be able to quickly find a particular file.
It uses llama3.2 3b by default. This model is only 2 GB so it is pretty fast to run, and should be able to run on laptops, even without a GPU. A folder of 40 PDFs processed in less than two minutes on my machine.
You can get the script here: https://github.com/JonGerhardson/pdf_renamer/tree/main
If you try it out let me know. In the future I’d like to tweak it so that the files are all changed following a more uniform naming scheme, but I’ve already procrastenated enough for today.
Here’s some before/after shots if you’re not understanding what this does.
It lets you go from this:
To this: