#!/bin/bash

dest_path=/espa-storage/downloads/collections/l2-ard-tiles

tile_id=${1}
tile_md5_list=${1}.md5_list
archive_dir=${2}

mkdir -p ${dest_path}/${archive_dir}

if [ -d "${dest_path}/${tile_id}" ]; then
    echo "Found";
    mv ${dest_path}/${tile_id} ${dest_path}/${archive_dir}
else
    echo "Not Found";
fi

mv ${tile_id} ${dest_path}
cp ${tile_md5_list} ${dest_path}/${tile_id}
mv ${tile_md5_list} backup_manifests

