Finding annotated PDFs

Using find and grep, you can look for PDFs that are annotated (searches recursively from the current directory).

find . -name '*.pdf' -exec grep -E '(Annot /T)|(/Name /Comment)' {} +

Neat huh.

Advertisements

Unzip and flatten multiple zip-files on a Mac (bash)

Here’s just a quick note to my future self (other people are free to take part of it too though).

When using the * character to unzip several files using the unzip command on a Mac, the * has to be escaped as unzip wants to do its file listing by itself, rather than having bash do it for it.

So instead of writing unzip *.zip, you would write \*.zip.

Also as a final note to self, to unzip several zip-files into e.g. the parent directory and also ignore any directory structure contained by the zip file + overwriting any duplicate files, one would write

unzip -o -j -d ../ \*.zip