Here's a script I copied from somewhere on the internet 2 or 3 years ago. Unfortunately, I didn't keep a record of where I got it, so I don't know to whom to give credit. I've modified it slightly to fit your situation.
Code:
#! /bin/bash
# blank-rename.sh
#
# Substitutes underscores for blanks in all the filenames in a directory.
# The comment above reflects the original purpose of this script.
# I have changed the script to substitute dash (-) for apostrophe (').
ONE=1 # For getting singular/plural right (see below).
number=0 # Keeps track of how many files actually renamed.
FOUND=0 # Successful return value.
for filename in * #Traverse all files in directory. Edit to add path to directory
do # + containing the files indicated by the wildcard *.
echo "$filename" | grep -q "'" # Check whether filename
if [ $? -eq $FOUND ] #+ contains apostrophe(s).
then
fname=$filename # Strip off path.
n=`echo $fname | sed -e "s/'/-/g"` # Substitute dash for apostrophe.
mv "$fname" "$n" # Do the actual renaming.
let "number += 1"
fi
done
if [ "$number" -eq "$ONE" ] # For correct grammar.
then
echo "$number file renamed."
else
echo "$number files renamed."
fi
exit 0
Notice that at the beginning of the loop, you should edit the script to add the path to the directory containing the files with the apostrophe (') in the name.
Example: for filename in /home/<username>/files/*