Linux-fu: Remove spaces from all filenames in a directory

Reading time: less than 1 minute

I needed to remove spaces from a whole list of files in a directory. A short bash script took care of it easy:

$ for file in *; do 
> newFile=$(echo $file | tr ' ' _)
> mv "$file" $newFile
> done

Date: 2009-Mar-14
Tags: linux
Previous: Happy π (Pi) Day!
Next: Snippet: Php recursive flatten array

In December 2017 this post was imported from an archive of my pre-2009 blog stored by archive.org.
Consider a donation to archive.org if you find this content valuable.