Perhaps you're like me, and have several years worth of JPEG files with names like "Aunt Sue's Birthday.jpg" These are a pain to deal with when putting together a web page, because most browsers don't handle spaces in file names well - you have to escape them with %20 or similar. I finally wrote a shell script that squeezes the spaces out of file names
Read the rest of the article for the script and a method for using it from the Finder instead of the Terminal...
The script:
#!/bin/sh[Editor's note: Copy and paste the text into a text editor, save the script, and then make it executable (chmod 755 sqzspaces.sh in the Terminal). To make it run from anywhere, make sure it's in a folder on your path -- I use ~/bin for my scripts, for example.]
# this shell script removes the spaces out of the name of every file argument
# passed to it (handles an arbitrary number of files on the command line).
# example:
# sqzspaces.sh "/Users/Kurt/Name With Spaces"
# results in changing the filename to "/Users/Kurt/NameWithSpaces"
for OriginalFile
do
Location=`dirname "$OriginalFile"`
FileName=`basename "$OriginalFile"`
ShortName=`echo $FileName | sed 's/ //g'`
if [ $ShortName != "$FileName" ]
then
cd "$Location"
mv "$FileName" "$ShortName"
fi
done
Mac OS X Hints
http://hints.macworld.com/article.php?story=20020611094717930