# Removes spaces in filenames (replaces them with underscore) # Thu, 18 Oct 2007 21:34:45 -0400 # source: # http://sgowtham.net/blog/2007/10/18/bash-replace-space-in-filenames-with-underscore/ echo "Usaage:" echo "$0 $1:" cd $1 for file in *; do echo Converting "$file" to "${file// /0}" mv "$file" "${file// /0}" done cd - echo "Name conversion is done" #Alternatively on can use sed command, for ex.: #echo "This is just a test" | sed -e 's/ /0/g'#! /bin/bash