Replace spaces in filenames with underscores
for f in *;do mv “$f” “${f// /_}”;done
How this script works and how to use it:
- This script will replace spaces in file names with underscores
- It will do this in the directory that you are currently in
- This rewrites all the files with underscores
- It uses the mv command to do its job
For more Shell one-liners – click here