#!/bin/bash

# CONFIG
TAR_DIR="/insert/download/folder/here"
RESTORE_DIR="/parent_folder/event_based_satellite_docking"
MANIFEST="$TAR_DIR/manifest.csv"

mkdir -p "$RESTORE_DIR"

tail -n +2 "$MANIFEST" | while IFS=, read -r tarfile original_path; do
    # Extract tars to original folder structure 
    tar -xf "$TAR_DIR/$tarfile" -C "$RESTORE_DIR"
    echo "Restored: $original_path"
done
