Skip to content

Instantly share code, notes, and snippets.

@tobius
Last active August 29, 2015 13:56
Show Gist options
  • Save tobius/8865878 to your computer and use it in GitHub Desktop.
Save tobius/8865878 to your computer and use it in GitHub Desktop.
Convert a batch of pdf files into a single text dump
#!/bin/bash
##---------------------------------------------------------------------##
## Convert a batch of pdf files into a single text dump ##
## @author Toby Miller <tobius.miller@gmail.com> ##
## ##
## setup: brew install xpdf ##
## usage: cd pdffolder && batchpdftotext [out.txt] ##
##---------------------------------------------------------------------##
if [[ -z "$1" ]]
then
find . -type f -name '*.pdf' -exec pdftotext -raw {} /dev/stdout \;
else
(find . -type f -name '*.pdf' -exec pdftotext -raw {} /dev/stdout \;) > "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment