Title: bad-filenames-display.sh.2015.05.27 \\ Created: 2018-04-29 22:25:21 ====== This shell script will display files with bad names and will show what the rename script will do ====== ---- #!/bin/bash find . -depth -name "*[^a-zA-Z0-9._-]*" | # Find all files or folders containing 'bad' characters. while read FILEDIR # Read them line-by-line. do DIR="${FILEDIR%/*}" # Get the folder its inside FILE="${FILEDIR/*\/}" # Get the plain name. NEWFILE="${FILE//[^a-zA-Z0-9._-]/_}" # Substitute _ for bad things. echo From: "$DIR/$FILE" To: "$DIR/$NEWFILE" # Rename it. done