I have setup the docker container to run the model evaluation.
Run find . -name "*.pdf" -exec python3 process.py {} txt/{}.txt \; but don't rewrite files that already exist. Instead of .pdf.txt make it just .txt
Run find . -name "*.pdf" -exec python3 process.py {} txt/{}.txt \; but don't rewrite files that already exist. Instead of .pdf.txt make it just .txt
You can achieve this by using the `-ok` option instead of `-exec`, which will prompt the user before executing the command. However, since you want to automate this process, you can use a bash script to check if the file exists before executing the command. Here's an example of how you can modify the command to achieve this:
1 | find . -name "*.pdf" -exec bash -c 'if [ ! -f "txt/{}.txt" ]; then python3 process.py {} txt/{}.txt; fi' \; |
1 | find . -name "*.pdf" -exec bash -c 'f="{}"; txt_file="txt/${f%.pdf}.txt"; if [ ! -f "$txt_file" ]; then python3 process.py "$f" "$txt_file"; fi' \; |
I extracted the following code from that output:
1 2 3 | #!/bin/bash find . -name "*.pdf" -exec bash -c 'f="{}"; txt_file="txt/${f%.pdf}.txt"; if [ ! -f "$txt_file" ]; then python3 process.py "$f" "$txt_file"; fi' \; |
Running the following program:
1 2 3 | #!/bin/bash find . -name "*.pdf" -exec bash -c 'f="{}"; txt_file="txt/${f%.pdf}.txt"; if [ ! -f "$txt_file" ]; then python3 process.py "$f" "$txt_file"; fi' \; |
final: True Resulting in output: True