From e1d64e8bbcb1e3c709107911faf5d22356643f55 Mon Sep 17 00:00:00 2001 From: Simon Rieger Date: Fri, 11 Feb 2022 14:41:22 +0100 Subject: [PATCH] while read bugfix --- ocr-deamon.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ocr-deamon.sh b/ocr-deamon.sh index 42c3243..582f1af 100755 --- a/ocr-deamon.sh +++ b/ocr-deamon.sh @@ -2,6 +2,11 @@ set -x DOKUMENT_DIR=/home/simono41/data1/Dokumente -for file in $(find ${DOKUMENT_DIR} -path ${DOKUMENT_DIR}/.stversions -prune -o -name "*.pdf" ! -name '*-ocr.pdf' -print); do - ocrmypdf -l deu --force-ocr --jbig2-lossy ${file} ${file%.*}-ocr.pdf -done +find ${DOKUMENT_DIR} -path ${DOKUMENT_DIR}/.stversions -prune -type f -o -name "*.pdf" ! -name '*-ocr.pdf' -print | while read file; do + if ! [ -f "${file%.*}-ocr.pdf" ]; then + ocrmypdf -l deu --force-ocr --jbig2-lossy "${file}" "${file%.*}-ocr.pdf" + sleep 1 + else + echo "Datei wurde bereits verarbeitet" + fi +done