#!/bin/bash # Check if a base directory was provided as an argument if [ "$#" -gt 1 ]; then echo "Usage: $0 " exit 1 elif [ "$#" -eq 1 ]; then BASE_DIR="$1" else BASE_DIR="GRID-dataset" fi # Loop from s1 to s34 for i in {1..34}; do # Check if the directory exists before attempting to move files if [[ -d "${BASE_DIR}/s${i}/s${i}" ]]; then mv "${BASE_DIR}/s${i}/s${i}"/* "${BASE_DIR}/s${i}/" fi done