I would use 'mmv' to do this:
Though the above command would need to be run several times (until it says 'No match') and it can be a pain to install if your distro doesnt provide it
This might work with bash (its not recursive though):
Code:
for file in *\'*; do
newfile=`echo $file | sed -e "s/'//g"`
echo $newfile
mv "$file" "$newfile"
done
In your other script (I am assuming that its a shell script too) you could try
Code:
escaped=`echo "$file" | sed -e "s/'/\\\\'/g"`
note that the four backslashes in that command is due to multiple levels of escaping, sed wants \\ in its input but the double quotes needs escaping too so it becomes \\\\