From 651af5a3b7d21a22550b0609bec2f72f4358ad78 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Thu, 30 Sep 2021 15:11:14 -0400 Subject: [PATCH] adding data clearing tool --- scripts/clear_all_data.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 scripts/clear_all_data.sh diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.sh new file mode 100755 index 0000000..e83e24c --- /dev/null +++ b/scripts/clear_all_data.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# This script removes all data that has been collected. It is tantamount to +# starting all data-collection from scratch. Only run this if you are sure +# you are okay will losing all the data that you've collected and processed +# so far. +source /etc/birdnet/birdnet.conf + +echo " +This script removes all data that has been collected. It is tantamount to +starting all data-collection from scratch. Only run this if you are sure +you are okay with losing all the data that you've collected and processed +so far. + +" +read -n1 -p "Are you sure you want to wipe away ALL data?" YN +echo +while true; do + case $YN in + [Yy]) break;; + *) echo "Exiting since you didn't answer with Y or y." && exit;; + esac +done +echo "Removing all data . . . " +sudo rm -drf "${RECS_DIR}" +rm "${IDFILE}" + +echo "Recreating necessary directories" +[ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} +[ -d ${EXTRACTED} ] || mkdir -p ${EXTRACTED} +[ -d ${EXTRACTED}/By_Date ] || mkdir -p ${EXTRACTED}/By_Date +[ -d ${EXTRACTED}/By_Common_Name ] || mkdir -p ${EXTRACTED}/By_Common_Name +[ -d ${EXTRACTED}/By_Scientific_Name ] || mkdir -p ${EXTRACTED}/By_Scientific_Name +[ -d ${PROCESSED} ] || mkdir -p ${PROCESSED}