for name in *; do mv "$name" "${name// /_}"; done
How to replace the spaces in filenames with underscore [duplicate]: https://unix.stackexchange.com/questions/321448/how-to-replace-the-spaces-in-filenames-with-underscore/321456
Into bash
for all the files into folder.
for name in *; do mv "$name" "${name// /_}"; done
The ${name/pattern/replace}
replaces pattern
to replace
(Bash Parameter Expansion). If pattern starts with /
(here pattern is /
+ Space
), it replaces all the occurencies. Then mv
renames file from name
to new name with replaced spaces.
edited Nov 6 '16 at 15:52 and answered Nov 6 '16 at 15:46 by Konstantin Morenko