If you need to rename several files at the same time, in this tutorial I will show you a couple of ways to do it.

Table of Contents

Bulk Rename (GUI)

Thunar’s Bulk Rename is the default software for this file manager used in XFCE. You can add the files with the “+” button and select the type of rename you want to perform: modify audio tags, insert date/time in the filename, insert or overwrite characters, numbering, remove characters, replace, and change to uppercase or lowercase.

Bulk Rename window

KRename (GUI)

This KDE batch file renamer. Rename process is divided in four steps: select files, define destination, select optional plugins (for reading file tags, changing file permissions, etc.), and, finally, define the rename. Click ‘Finish’ to run the renaming process. KRename could be the best bulk renaming program I tested.

KRename

Rename (Terminal)

rename from util-linux

This rename package is likely installed on your system. Also known as rename.ul(on Debian).

rename <expression> <replacement> <files>
rename -a ' ' '-' file\ with\ spaces.txt

Some available parameters:

  • -a: replace all ocurrencies, not just the first one.
  • -v: display what it’s doing.
  • -n: don’t make any changes.

rename from perl

This perl extension shows as perl-rename on Arch Linux and rename on Debian, and also allows batch renaming.

rename <expression> <files>
rename 's/DSC/ABC/' *.txt

More examples:

  • Change uppercase to lowercase:
      rename 'y/A-Z/a-z/' *
    
  • Add preceding zeros:
      # ls
      abc_1.txt    abc_18.txt  abc_27.txt  abc_36.txt  abc_45.txt  abc_54.txt  abc_63.txt  abc_72.txt  abc_81.txt  abc_90.txt
      abc_10.txt   abc_19.txt  abc_28.txt  abc_37.txt  abc_46.txt  abc_55.txt  abc_64.txt  abc_73.txt  abc_82.txt  abc_91.txt
      abc_100.txt
    
      # rename 's/abc_/abc_0/' abc_??.txt
      # rename 's/abc_/abc_00/' abc_?.txt
    
      # ls
      abc_001.txt  abc_011.txt  abc_021.txt  abc_031.txt  abc_041.txt  abc_051.txt  abc_061.txt  abc_071.txt  abc_081.txt  abc_091.txt
      abc_002.txt  abc_012.txt  abc_022.txt  abc_032.txt  abc_042.txt  abc_052.txt  abc_062.txt  abc_072.txt  abc_082.txt  abc_092.txt
    

Some interesting parameters are:

  • -n: do not make any changes, just print the filenames before and after.
  • -h: show the help.

If you have any suggestion, feel free to contact me via social media or email.