How to do a mass rename?

Easiest solution is to use “mmv”

You can write:

mmv "long_name*.txt" "short_#1.txt"

Where the “#1” is replaced by whatever is matched by the first wildcard.
Similarly #2 is replaced by the second, etc.

So you do something like

mmv "index*_type*.txt" "t#2_i#1.txt"

To rename index1_type9.txt to t9_i1.txt

mmv is not standard in many Linux distributions but is easily found on the net.

Leave a Comment