at_test / 3.3.Delete_Input_Output.sh
corsair4090's picture
Upload 10 files
e250d47 verified
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # Sin color
clear
echo "===================================================="
echo -e " ${RED}Clean and Delete 'input' and 'output' Folders${NC}"
echo "===================================================="
echo
echo -e "${YELLOW}[WARNING]${NC} This script will delete the 'input' and 'output' folders"
echo " and all their contents in the current directory."
echo "===================================================="
echo
read -p "¿Are you sure you want to proceed? (Y/N) " confirm
confirm_upper=$(echo "$confirm" | tr '[:lower:]' '[:upper:]')
if [ "$confirm_upper" != "Y" ]; then
echo -e "${RED}[CANCELED]${NC} Operation cancelled by user."
read -p "Press Enter to continue..."
exit 1
fi
echo
eliminar_carpeta() {
local carpeta="$1"
if [ -d "$carpeta" ]; then
echo -e "[PROCESSING] Deleting '${carpeta}' folder..."
rm -rf "$carpeta"
if [ ! -d "$carpeta" ]; then
echo -e "${GREEN}[SUCCESS]${NC} '${carpeta}' folder deleted."
else
echo -e "${RED}[ERROR]${NC} Failed to delete folder '${carpeta}'."
fi
else
echo -e "[INFO] Folder '${carpeta}' does not exist. Skipping..."
fi
echo
}
eliminar_carpeta "input"
eliminar_carpeta "output"
eliminar_carpeta "BatchConfig"
echo "===================================================="
echo " All specified folders have been"
echo " processed correctly."
echo "===================================================="
echo
read -p "Press Enter to continue..."
exit 0