From 43646d05ced5fac81ab5024751af9c4d1b2e449f Mon Sep 17 00:00:00 2001 From: grzegorzZ1 Date: Sat, 11 Nov 2023 23:44:52 +0100 Subject: [PATCH] Logging upgraded and bug fixed --- container_run.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/container_run.sh b/container_run.sh index ad3a05b..ae6921c 100644 --- a/container_run.sh +++ b/container_run.sh @@ -5,15 +5,27 @@ mkdir /common mkdir /common/processed_ttl for archive in "${archives[@]}"; do - mkdir /home/output_ttl_files/$archive + archive_dir=/home/output_ttl_files/$archive + if [ ! -d "$archive_dir" ]; then + mkdir $archive_dir + fi for dir in "/input_pdf_files/$archive"/*; do if [ -d "$dir" ]; then - mkdir /home/output_ttl_files/$archive/$(basename "$dir") + volume_dir=/home/output_ttl_files/$archive/$(basename "$dir") + if [ ! -d "$volume_dir" ]; then + mkdir $volume_dir + fi for file in "$dir"/*; do if [ -f "$file" ]; then cp "$file" /common/$(basename "$file" .pdf).pdf bash ./run.sh /common/$(basename "$file" .pdf).pdf - cp /common/processed_ttl/$(basename "$file" .pdf | tr '[:upper:]' '[:lower:]' | tr -d '_').ttl /home/output_ttl_files/$archive/$(basename "$dir")/$(basename "$file" .pdf).ttl + final_basename=$(basename "$file" .pdf | tr '[:upper:]' '[:lower:]' | tr -d '_') + if [ -e "/common/processed_ttl/$final_basename.ttl" ]; then + cp /common/processed_ttl/$final_basename.ttl /home/output_ttl_files/$archive/$(basename "$dir")/$(basename "$file" .pdf).ttl + else + echo "Grobid failed with scraping file, information from it will be skipped" + fi + fi done fi