Remove spaces from filenames

Posted on Wed 15 July 2020 in dev-journal

Here is a great little bash command to remove all of the spaces of a filename and replace them with an underscore for all files in the current directory.

for f in *\ *; do mv "$f" "${f// /_}"; done