Added cleanup function

This commit is contained in:
Skylar Grant 2024-06-22 17:18:23 -04:00
parent 1594a699e5
commit 23c34af92b
2 changed files with 59 additions and 18 deletions

View File

@ -107,14 +107,39 @@ create_folders_nas() {
fi fi
} }
# Cleanup non-RAW images on camera. # Cleanup images on camera SD.
clean_sd() { clean_sd() {
# Check if the SD card is mounted
if mount | grep -q "/Volumes/NO NAME"; then
# Get the SD Card mount point, this is static though
SD_MOUNT_POINT="/Volumes/NO NAME"
echo "SD Card Mounted at $SD_MOUNT_POINT."
else
echo "ERR: SD Card Not mounted!"
exit 1
fi
echo "Traversing to Camera..." echo "Traversing to Camera..."
cd "$SD_MOUNT_POINT/$SD_SRC_PATH" cd "$SD_MOUNT_POINT$SD_SRC_PATH" || { echo "Failed to navigate to SD card path."; return 1; }
echo "Removing JPG files..." echo "Current Directory: $(pwd)"
rm *.JPG echo "Are you sure you want to delete all JPG, ARW, and MP4 files in $SD_MOUNT_POINT$SD_SRC_PATH? (y/N)"
echo "Cleanup completed!" read -r confirmation
cd -
if [[ "$confirmation" =~ ^[Yy]$ ]]; then
echo "Removing JPG files..."
rm *.JPG
echo "Removing ARW files..."
rm *.ARW
echo "Removing MP4 files..."
rm *.MP4
echo "Cleanup completed!"
else
echo "Cleanup aborted."
fi
cd - || { echo "Failed to return to the previous directory."; return 1; }
} }
# Camera->Mac Ingest # Camera->Mac Ingest
@ -219,7 +244,7 @@ while true; do
echo "" echo ""
echo "[1] Camera->Mac Ingest" echo "[1] Camera->Mac Ingest"
echo "[2] Mac->NAS Ingest" echo "[2] Mac->NAS Ingest"
echo "[X] Cleanup non-RAW images on camera." echo "[3] Cleanup non-RAW images on camera."
echo "" echo ""
echo "[0] Exit" echo "[0] Exit"
@ -241,8 +266,8 @@ while true; do
3) 3)
# Cleanup non-RAW images on camera. # Cleanup non-RAW images on camera.
clear clear
echo "Temporarily disabled!" # echo "Temporarily disabled!"
# clean_sd clean_sd
;; ;;
0) 0)
# Exit the script # Exit the script

View File

@ -112,11 +112,27 @@ create_folders_nas() {
# Cleanup non-RAW images on drone. # Cleanup non-RAW images on drone.
clean_sd() { clean_sd() {
echo "Traversing to Drone..." echo "Traversing to Drone..."
cd "$SD_MOUNT_POINT/$SD_SRC_PATH" cd "$SD_MOUNT_POINT$SD_SRC_PATH" || { echo "Failed to navigate to SD card path."; return 1; }
echo "Removing JPG files..."
rm *.JPG echo "Are you sure you want to delete all JPG, DNG, and MP4 files in $SD_MOUNT_POINT$SD_SRC_PATH? (y/N)"
echo "Cleanup completed!" read -r confirmation
cd -
if [[ "$confirmation" =~ ^[Yy]$ ]]; then
echo "Removing JPG files..."
rm *.JPG
echo "Removing DNG files..."
rm *.DNG
echo "Removing MP4 files..."
rm *.MP4
echo "Cleanup completed!"
else
echo "Cleanup aborted."
fi
cd - || { echo "Failed to return to the previous directory."; return 1; }
} }
# Drone->Mac Ingest # Drone->Mac Ingest
@ -220,7 +236,7 @@ while true; do
echo "" echo ""
echo "[1] Drone->Mac Ingest" echo "[1] Drone->Mac Ingest"
echo "[2] Mac->NAS Ingest" echo "[2] Mac->NAS Ingest"
echo "[X] Cleanup non-RAW images on drone." echo "[3] Cleanup images on drone."
echo "" echo ""
echo "[0] Exit" echo "[0] Exit"
@ -240,10 +256,10 @@ while true; do
ingest_nas ingest_nas
;; ;;
3) 3)
# Cleanup non-RAW images on drone. # Cleanup images on drone.
clear clear
echo "Temporarily disabled!" # echo "Temporarily disabled!"
# clean_sd clean_sd
;; ;;
0) 0)
# Exit the script # Exit the script