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
}
# Cleanup non-RAW images on camera.
# Cleanup images on camera 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..."
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 "Current Directory: $(pwd)"
echo "Are you sure you want to delete all JPG, ARW, and MP4 files in $SD_MOUNT_POINT$SD_SRC_PATH? (y/N)"
read -r confirmation
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!"
cd -
else
echo "Cleanup aborted."
fi
cd - || { echo "Failed to return to the previous directory."; return 1; }
}
# Camera->Mac Ingest
@ -219,7 +244,7 @@ while true; do
echo ""
echo "[1] Camera->Mac Ingest"
echo "[2] Mac->NAS Ingest"
echo "[X] Cleanup non-RAW images on camera."
echo "[3] Cleanup non-RAW images on camera."
echo ""
echo "[0] Exit"
@ -241,8 +266,8 @@ while true; do
3)
# Cleanup non-RAW images on camera.
clear
echo "Temporarily disabled!"
# clean_sd
# echo "Temporarily disabled!"
clean_sd
;;
0)
# Exit the script

View File

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