gasilcats.blogg.se

Install pdfinfo mac
Install pdfinfo mac










install pdfinfo mac

It is written in python, and functions a bit differently than yours, in that it accepts a single filename on stdin, reformats it, and writes the resultant new filename to stdout. I also have a script that I used for file renaming. It should also work with Hazel or Keyboard for this interesting posting! To rename all the PDFs in a given folder, you can do: pdf-rename-by-cdate.sh *.pdf

#Install pdfinfo mac how to#

If pdfinfo is not found, it won’t continue, but will tell you how to install it. If pdfinfo is unable to find a Creation Date, it will report an error but not rename the file. If you ask it to work on a file that is not a PDF, it will say “Hey, this isn’t a PDF” and skip it. I think this is basically what Finder does. If “filename (YYYY-MM-DD).pdf” already exists, it will try “filename (YYYY-MM-DD) 1.pdf” or “filename (YYYY-MM-DD) 2.pdf” etc until it does not find a conflicting file. If the original filename already has “YYYY-MM-DD” in it, then the script won’t rename it. If you give it “filename.pdf” it will rename it to “filename (YYYY-MM-DD).pdf” I was going to try to parse the info myself, but realized very quickly there are multiple formats used in a handful of PDFs that I tested, and pdfinfo worked with them all, so rather than reinvent the tool, I’m just building around one.Īnyway, it occurred to me that some folks here might be able to use this too.

install pdfinfo mac

Note that the script requires the tool pdfinfo from poppler which you can install via brew install poppler. I called it pdf-rename-by-cdate.sh because I am very clever. Over on the Hazel forum someone was trying to rename PDFs based on the original creation date of the PDF as found in the PDF metadata which is not necessarily the same date that Spotlight or Finder will show.Īlthough the OP was making the case that Hazel should include this by default, it does not (as far as I am aware, at least), so I did what I do, and wrote a script.












Install pdfinfo mac