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
To modify the command as you've requested, you can use the following:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for file in "$@"; do outfile="txt/$(basename "${file%.pdf}").txt" if [ ! -f "$outfile" ]; then python3 process.py "$file" "$outfile" fi done ' sh {} + |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for file in "$@"; do outfile="txt/$(basename "${file%.pdf}").txt" if [ ! -f "$outfile" ]; then python3 process.py "$file" "$outfile" fi done ' sh {} + |
Running the following program:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for file in "$@"; do outfile="txt/$(basename "${file%.pdf}").txt" if [ ! -f "$outfile" ]; then python3 process.py "$file" "$outfile" fi done ' sh {} + |
final: True Resulting in output: True
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
To achieve what you're asking for, you can modify the command as follows:
1 2 3 4 5 6 7 8 9 10 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt="${pdf%.pdf}.txt" txt="txt/${txt#./}" if [ ! -f "$txt" ]; then mkdir -p "$(dirname "$txt")" python3 process.py "$pdf" "$txt" fi done ' sh {} + |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 10 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt="${pdf%.pdf}.txt" txt="txt/${txt#./}" if [ ! -f "$txt" ]; then mkdir -p "$(dirname "$txt")" python3 process.py "$pdf" "$txt" fi done ' sh {} + |
Running the following program:
1 2 3 4 5 6 7 8 9 10 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt="${pdf%.pdf}.txt" txt="txt/${txt#./}" if [ ! -f "$txt" ]; then mkdir -p "$(dirname "$txt")" python3 process.py "$pdf" "$txt" fi done ' sh {} + |
final: True Resulting in output: True
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
To achieve what you're asking, you can modify the command as follows:
1 2 3 4 5 6 7 8 9 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt="${pdf%.pdf}.txt" txt="txt/${txt#./}" if [ ! -f "$txt" ]; then mkdir -p "$(dirname "$txt")" python3 process.py "$pdf" "$txt" fi ' sh {} + |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 9 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt="${pdf%.pdf}.txt" txt="txt/${txt#./}" if [ ! -f "$txt" ]; then mkdir -p "$(dirname "$txt")" python3 process.py "$pdf" "$txt" fi ' sh {} + |
Running the following program:
1 2 3 4 5 6 7 8 9 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt="${pdf%.pdf}.txt" txt="txt/${txt#./}" if [ ! -f "$txt" ]; then mkdir -p "$(dirname "$txt")" python3 process.py "$pdf" "$txt" fi ' sh {} + |
sh: 9: Syntax error: end of file unexpected (expecting "done")
Traceback (most recent call last): File "/usr/src/app/check.py", line 6, in <module> print('final: ' + str(check_ok())) File "/usr/src/app/check.py", line 3, in check_ok return open("txt/a.txt").read() == "done1" and open("txt/b.txt").read() == "hello2" and open("txt/c.txt").read() == "done3" and len(os.listdir("txt")) == 3 FileNotFoundError: [Errno 2] No such file or directory: 'txt/b.txt' Resulting in output: False
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
To achieve what you're asking, you can modify the command to check if the output file already exists before processing. Here's the updated command:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt_file="txt/$(basename "${pdf%.pdf}").txt" if [ ! -f "$txt_file" ]; then python3 process.py "$pdf" "$txt_file" fi done ' sh {} + |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt_file="txt/$(basename "${pdf%.pdf}").txt" if [ ! -f "$txt_file" ]; then python3 process.py "$pdf" "$txt_file" fi done ' sh {} + |
Running the following program:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for pdf in "$@"; do txt_file="txt/$(basename "${pdf%.pdf}").txt" if [ ! -f "$txt_file" ]; then python3 process.py "$pdf" "$txt_file" fi done ' sh {} + |
final: True Resulting in output: True
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
To run the command without overwriting existing files and to change the output file extension from .pdf.txt to .txt, you can use the following modified command:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for file do outfile=$(echo "txt/${file%.pdf}.txt" | sed "s|^\./||") if [ ! -f "$outfile" ]; then python3 process.py "$file" "$outfile" fi done ' sh {} + |
I extracted the following code from that output:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for file do outfile=$(echo "txt/${file%.pdf}.txt" | sed "s|^\./||") if [ ! -f "$outfile" ]; then python3 process.py "$file" "$outfile" fi done ' sh {} + |
Running the following program:
1 2 3 4 5 6 7 8 | find . -name "*.pdf" -exec sh -c ' for file do outfile=$(echo "txt/${file%.pdf}.txt" | sed "s|^\./||") if [ ! -f "$outfile" ]; then python3 process.py "$file" "$outfile" fi done ' sh {} + |
final: True Resulting in output: True