encrypted_dna / delete_extra_dirs.sh
kcelia's picture
chore : typo
f852cd7 unverified
raw
history blame contribute delete
895 Bytes
#!/bin/bash
# Define the base directories (adjust if needed)
BASE_DIR1="$(pwd)/deployment/base_modules" # First base directory
BASE_DIR2="$(pwd)/deployment/smoother_module" # Second base directory
# Function to check directory and delete long numeric named directories
cleanup_directory() {
local DIR="$1"
# Check if the base directory exists
if [ ! -d "$DIR" ]; then
echo "Directory $DIR does not exist."
exit 1
fi
# Find and delete directories with long numeric names
echo "Searching for directories with long numeric names inside $DIR..."
find "$DIR" -type d -regextype posix-extended -regex '.*/[0-9]{15,}' -exec rm -rf {} +
# Confirm completion
echo "Cleanup complete for $DIR. All directories with long numeric names have been removed."
}
# Call the function for each base directory
cleanup_directory "$BASE_DIR1"
cleanup_directory "$BASE_DIR2"