-
-
Save Senya247/36664c5c8d225c03b1640418a3556e5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
folder_path="." | |
ocr_script="./ocrpdf.sh" | |
while true; do | |
files=$(find "$folder_path" -type f -name "*Module.pdf") | |
IFS=$'\n' | |
for file in $files; do | |
t_file="${file%Module.pdf}Module_t.pdf" | |
if [ ! -f "$t_file" ]; then | |
if lsof -w "$file" > /dev/null; then | |
echo "File '$file' is being written to. Skipping OCR." | |
else | |
echo "Running OCR for file: '$file'" | |
"$ocr_script" "$file" | |
fi | |
fi | |
done | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment