From 1552f5dcd8b0abe89f53182c7a495a7b8dc008fc Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 8 Apr 2020 15:51:47 -0700 Subject: helper bash scripts for PDF derivatives These are lazy (won't run derive process if output already exists), which makes the process much faster --- bin/make_dir_derivatives.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/make_dir_derivatives.sh (limited to 'bin/make_dir_derivatives.sh') diff --git a/bin/make_dir_derivatives.sh b/bin/make_dir_derivatives.sh new file mode 100755 index 0000000..c33d75d --- /dev/null +++ b/bin/make_dir_derivatives.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e -u -o pipefail + +export FULLTEXTDIR=$1 + +if [ ! -d $FULLTEXTDIR ]; then + echo "Directory does not exist: $FULLTEXTDIR" + exit -1 +fi + +# make directories +ls $FULLTEXTDIR/pdf/ | parallel mkdir -p $FULLTEXTDIR/pdftotext/{} +ls $FULLTEXTDIR/pdf/ | parallel mkdir -p $FULLTEXTDIR/thumbnail/{} + +fd -I .pdf $FULLTEXTDIR/pdf/ | sed "s/\.pdf//g" | cut -d/ -f3-4 | parallel -j10 ./bin/make_pdf_derivatives.sh $FULLTEXTDIR {} -- cgit v1.2.3