varuolo

RSS
Feb 4

Removing spaces from a file using bash

I recently had the need to remove all spaces from filenames in a particular directory. After navigating into the directory where the files reside, I then execute the following:

for f in *; do mv “$f” “$(echo $f | sed ’s/ //g’)”; done