On Fri, Sep 24, 2010 at 3:05 PM, Robin Gareus <robin@email-addr-hidden> wrote:
> ..and in case there are files with whitespaces in the filename, change
> the default string separator:
>
> #/bin/bash
> IFS=:
> # do stuff
> unset IFS
Or remove spaces from all filenames. Why would one want spaces in filenames anyway ?
To me it feels a bit like putting spaces in variable names, which isn't a good idea either.
Cheers,
Marc
#! /bin/bash
#
# spaces2underscores.sh
echo
echo "This command changes all spaces in file names into underscores"
echo " for ALL FILES IN THIS DIRECTORY !"
echo " Type ENTER to continue or ^C to quit"
read dummy
for f in *; do
oldname=`echo $f |sed 's/ /~/g'`
newname=`echo $f |sed 's/ /_/g'`
if [ $oldname != $newname ]
then
echo mv $f $newname
mv "$f" $newname
fi
done
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Sat Sep 25 12:15:06 2010
This archive was generated by hypermail 2.1.8 : Sat Sep 25 2010 - 12:15:06 EEST