Compare commits

..

No commits in common. "7b00a6584b6d6e77c54e0f3365a898f6338d36b2" and "2949e09aeebe68bc38d33d0f80de6de8a9a884d0" have entirely different histories.

View File

@ -4,13 +4,8 @@
BACKUP_HASH="$1" BACKUP_HASH="$1"
# Define main directory containing subdirectories to potentially be deleted # Define main directory containing subdirectories to potentially be deleted
MAIN_DIRECTORY="/Backups/$BACKUP_HASH/backup-docker-to-local" MAIN_DIRECTORY="/Backups/$BACKUP_HASH/docker-volume-backup"
if [ -d "$MAIN_DIRECTORY" ]; then echo "Checking backup directory: $MAIN_DIRECTORY"
echo "Cleaning up directory: $MAIN_DIRECTORY"
else
echo "Error: $MAIN_DIRECTORY does not exist."
exit 1
fi
# Define trigger directory argument as TRIGGER_DIR # Define trigger directory argument as TRIGGER_DIR
TRIGGER_DIR="$2" TRIGGER_DIR="$2"
@ -20,12 +15,8 @@ for SUBDIR in "$MAIN_DIRECTORY"/*; do
# Only proceed if it is a directory # Only proceed if it is a directory
if [ -d "$SUBDIR" ]; then if [ -d "$SUBDIR" ]; then
echo "Validating directory: $SUBDIR"
# Only proceed if the specified trigger directory does not exist within the subdirectory # Only proceed if the specified trigger directory does not exist within the subdirectory
FULL_TRIGGER_DIR_PATH="$SUBDIR/$TRIGGER_DIR" if [ ! -d "$SUBDIR/$TRIGGER_DIR" ]; then
if [ ! -d "$FULL_TRIGGER_DIR_PATH" ]; then
echo "Validation: error"
echo "Missing directory: $FULL_TRIGGER_DIR_PATH"
# Display the subdirectory contents # Display the subdirectory contents
echo "Contents of subdirectory: $SUBDIR" echo "Contents of subdirectory: $SUBDIR"
ls "$SUBDIR" ls "$SUBDIR"
@ -40,8 +31,7 @@ for SUBDIR in "$MAIN_DIRECTORY"/*; do
rm -vrf "$SUBDIR" rm -vrf "$SUBDIR"
fi fi
else else
echo "Validation: ok" echo "$SUBDIR contains $TRIGGER_DIR."
echo "$SUBDIR contains $FULL_TRIGGER_DIR_PATH."
fi fi
fi fi
done done