#!/bin/sh

while read -r line ; do
 prev="$line"/edgefile_sorted.tsv
  if [ -f "$prev" ]; then
    folder_new_name="$line".tar.bz2
    echo "Dealing with KGTK dump $line"
    #Check if the file is already being compressed
    if ! [ -f $folder_new_name ]; then
      if ! [ -f "kgtk_compressed_dumps/$folder_new_name" ]; then
        echo "Creating $folder_new_name ..."
        tar -cjvf $folder_new_name $line
        mv $folder_new_name kgtk_compressed_dumps
      else
        echo "Dump already compressed. Skipping"
      fi
    fi
  fi
done < dumps_to_compress.txt
