[LAU] No batch processing on Linux?
    Marc Groenewegen 
    marcg at dinkum.nl
       
    Sat Sep 25 06:49:58 UTC 2010
    
    
  
On Fri, Sep 24, 2010 at 3:05 PM, Robin Gareus <robin at xxxxxxxxxx> 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
    
    
More information about the Linux-audio-user
mailing list