Compare commits

..

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

View File

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