Logo
Note

Batch File Renaming with Bash

05/12/23

Rename multiple files in a directory, replacing spaces with underscores:

bash

#!/bin/bash for f in *\ *; do mv "$f" "$(echo $f | tr ' ' '_')" done