File size: 895 Bytes
65138e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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"