Monday, August 27, 2007

Removing all blank space in filenames

Here is a simple script to remove blank space in filenames in a directory tree. One could definitely use that script to change other characters too.
You can use it as a script or a single command line.

IFS=$'\n';for files in `find . -type f`; do NewFile=`echo $files | sed 's/ /_/g'`; mv "$files" $NewFile; done;unset IFS