#!/bin/bash OLDIFS=$IFS IFS=$'\n' # make newlines the only separator declare -a exprs=("\\\"([^\\\"]+)\\\"|“\1”" "\?|?" "\:|:" "\*|**" ">|>" "<|<" "\|||") sedexpr="" grepexpr="(" for i in "${exprs[@]}"; do sedexpr+="s|"$i"|g; " grepexpr+="$( cut -d '|' -f 1 <<< "$i" )|" done sedexpr="${sedexpr::-1}" grepexpr="${grepexpr::-1})" for path in $(find "$(pwd)" -type f); do file=$( basename "$path" ) [[ ! $( grep -E "$grepexpr" 2>/dev/null <<< "$file" ) ]] && continue while true; do question="The following command is about to run: $ mv \"$file\" \"$( sed -r "$sedexpr" <<< "$file" )\""$'\n'"Is this okay [y/n]? " read -p "$question" yn case $yn in [Yy]* ) mv "$file" "$( sed -r "$sedexpr" <<< "$file" )"; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac done done IFS=$OLDIFS # YOU CAN MAKE THE FILES GLOBAL THOUGH BY JUST REMOVING THE basename CLAUSE, SO DO THAT IF YOU GET ANNOYED AGAIN # MAKE IT WORK WITH DIRECTORIES, AS WELL AS ABSOLUTE FILEPATHS (currently you have to run it from the folder of the offending song)