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 to not overwrite existing files and use just `.txt` extension instead of `.pdf.txt`, you can use the following command:
1 | find . -name "*.pdf" -exec sh -c '[ ! -e "txt/${1%.pdf}.txt" ] && python3 process.py "${1}" "txt/${1%.pdf}.txt"' _ {} \; |
1 | mkdir txt
|
I extracted the following code from that output:
1 2 3 4 5 6 7 | #!/bin/bash # create txt directory if it doesn't exist mkdir -p txt # find all pdf files and convert them to text with .txt extension find . -name "*.pdf" -exec sh -c '[ ! -e "txt/${1%.pdf}.txt" ] && python3 process.py "${1}" "txt/${1%.pdf}.txt"' _ {} \; |
Running the following program:
1 2 3 4 5 6 7 | #!/bin/bash # create txt directory if it doesn't exist mkdir -p txt # find all pdf files and convert them to text with .txt extension find . -name "*.pdf" -exec sh -c '[ ! -e "txt/${1%.pdf}.txt" ] && python3 process.py "${1}" "txt/${1%.pdf}.txt"' _ {} \; |
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
You can modify the command to check if the corresponding `.txt` file already exists before running the `process.py` script. Here's the updated command:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" "txt/${0%.pdf}.txt"' {} \; |
I extracted the following code from that output:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" "txt/${0%.pdf}.txt"' {} \; |
Running the following program:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" "txt/${0%.pdf}.txt"' {} \; |
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
You can modify the command to check if the `.txt` file already exists before running the conversion. Here's one way to do it:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" txt/${0%.pdf}.txt' {} \; |
I extracted the following code from that output:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" txt/${0%.pdf}.txt' {} \; |
Running the following program:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" txt/${0%.pdf}.txt' {} \; |
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
You can modify the command to check if the corresponding `.txt` file already exists before running the `process.py` script. Here's how you can do it:
1 | find . -name "*.pdf" -exec sh -c 'f={}; t=$(dirname "$f")/$(basename "$f" .pdf).txt; [ ! -e "$t" ] && python3 process.py "$f" "$t"' \; |
I extracted the following code from that output:
1 | find . -name "*.pdf" -exec sh -c 'f={}; t=$(dirname "$f")/$(basename "$f" .pdf).txt; [ ! -e "$t" ] && python3 process.py "$f" "$t"' \; |
Running the following program:
1 | find . -name "*.pdf" -exec sh -c 'f={}; t=$(dirname "$f")/$(basename "$f" .pdf).txt; [ ! -e "$t" ] && python3 process.py "$f" "$t"' \; |
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 modify the command to avoid rewriting existing files and use just the `.txt` extension instead of `.pdf.txt`, you can use the following command:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" "txt/${0%.pdf}.txt"' {} \; |
I extracted the following code from that output:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" "txt/${0%.pdf}.txt"' {} \; |
Running the following program:
1 | find . -name "*.pdf" -exec sh -c '[ ! -f "txt/${0%.pdf}.txt" ] && python3 process.py "$0" "txt/${0%.pdf}.txt"' {} \; |
final: True Resulting in output: True