Theo Pepler

Home | Research | Teaching | Software | Links | HOWTO's

HOWTO: RENAME MULTIPLE FILES SIMULTANEOUSLY USING THE RENAME PROGRAM

File names containing spaces can be troublesome in Linux. Use the rename program as a shortcut to the arduous process of renaming files individually.
  1. Install the rename program using

    sudo apt install rename
  2. To replace spaces with dashes in all file names in the current directory, for example, use

    rename 's/ /-/g' *
  3. Alternatively, to change the names of files in the current directory and all subdirectories, use **

    rename 's/ /-/g' **
Source: Post on Linux Handbook.