Have you ever been faces with the problem of having a directory full of files and folders with spaces in them (take your MP3 collection for example)? Well here is an easy way to remove all those spaces and replace them with underscores. The only requirement is that you not have any files / directories with + signs in the name.
for i in `find . | tr "[:blank:]" "+" | grep "+"`; do echo "Changing Directory: " `echo $i | sed -r 's/\+/\\ /g'` " to " `echo $i | tr "+" "_"`; mv "`echo $i | sed -r 's/\+/\\ /g'`" `echo $i | tr "+" "_"`; done
The above code will change all files in the current directory and all below it. If you get any errors, simply run the command again. Keep running it until the errors are gone and you should be set.