Removing Spaces from Filenames

Feb 22, 2017 09:05 · 38 words · 1 minute read snippet

I do this enough to warrant throwing this into my .bash_alias file:

func despace() {
  mv "$1" `echo $1 | tr ' ' '-'`
}

This is nicely composable:

$ for file in * do; despace $file; done