diff --git a/README.md b/README.md index 20846a8..661e13b 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ You can configure the tool via environment variables: | IPADDRESS | mandatory | IP Address of your scanner | | RESOLUTION | optional | DPI resolution of scan, refer to capabilities of printer on startup | | REMOVE_BLANK_THRESHOLD | optional | Percentage of content in page until which a page is considered blank. A good default is 0.3. Blank pages are removed if this variable is defined | +| REMOVE_ORIGINAL_AFTER_OCR | optional | Deletes the original scan, once OCR file is saved (default: false) | | FTP_USER | optional | Username of an FTP(S) server to upload the completed scan to (see below) | | FTP_PASSWORD | optional | Username of an FTP(S) server to upload the completed scan to (see below) | | FTP_HOST | optional | Address of an FTP(S) server to upload the completed scan to (see below) | diff --git a/script/scanRear.sh b/script/scanRear.sh index eb3e40f..3fa0180 100755 --- a/script/scanRear.sh +++ b/script/scanRear.sh @@ -114,6 +114,12 @@ fi "${FTP_HOST}" \ "${FTP_PATH}" \ "/scans/${date}-ocr.pdf" + + if [ "${REMOVE_ORIGINAL_AFTER_OCR}" == "true" ]; then + if [ -f "/scans/${date}-ocr.pdf" ]; then + rm ${output_pdf_file} + fi + fi ) & fi ) & diff --git a/script/scantofile-0.2.4-1.sh b/script/scantofile-0.2.4-1.sh index 3a4cdf8..4e8c770 100755 --- a/script/scantofile-0.2.4-1.sh +++ b/script/scantofile-0.2.4-1.sh @@ -89,6 +89,12 @@ "${FTP_HOST}" \ "${FTP_PATH}" \ "/scans/${date}-ocr.pdf" + + if [ "${REMOVE_ORIGINAL_AFTER_OCR}" == "true" ]; then + if [ -f "/scans/${date}-ocr.pdf" ]; then + rm ${output_pdf_file} + fi + fi ) & fi ) &