removing spaces from filenames

[CLUE-Tech] removing spaces from filenames?

I borrowed a clue from this little script: works like a champ.


>8-----cut here------>8
#!/bin/sh
for i in * ; do
NEW=`echo $i| sed 's/ /_/g'`
if [ "$i" != "${NEW}" ]
then
(cd "$i" 2>/dev/null && $0)
mv "$i" "${NEW}"
echo "$i converted to ${NEW}"
else
echo 'The name is the same'
fi
done>
8-----cut here------>8