#!/bin/bash # Ask the user for the path to the folder read -p "Enter the path to the folder: " folder_path # Check if the provided path is valid if [ ! -d "$folder_path" ]; then echo "Invalid folder path. Please provide a valid directory." exit 1 fi # Find all .Trash-1000 directories within the provided path echo "Searching for .Trash-1000 folders in $folder_path..." trash_folders=$(find "$folder_path" -type d -name ".Trash-1000") if [ -z "$trash_folders" ]; then echo "No .Trash-1000 folders found." else echo "Found the following .Trash-1000 folders:" echo "$trash_folders" echo # Ask for confirmation before deletion read -p "Do you really want to delete all these folders? (y/n): " confirmation if [[ "$confirmation" == "y" || "$confirmation" == "Y" ]]; then # Loop through each found folder and delete it while displaying progress while IFS= read -r folder; do echo "Deleting folder: $folder" rm -rf "$folder" echo "Deleted $folder" done <<< "$trash_folders" echo "All .Trash-1000 folders have been deleted." else echo "Deletion canceled." fi fi