If you need to batch rename a set of files, the ‘rename‘ utility is much easier than alternatives such as pairing find/exec or even putting together a small script.
The rename utility gives you all the power of Perl regular expressions for converting the filenames.
# make sure utility is installed $ sudo apt install rename -y # set of files $ touch a-10.txt b-10.txt c-10.txt $ rename -v 's/10/99/' *.txt a-10.txt renamed as a-99.txt b-10.txt renamed as b-99.txt c-10.txt renamed as c-99.txt
If you wanted to remove the numbering altogether:
$ rename -v 's/-99//' *.txt a-99.txt renamed as a.txt b-99.txt renamed as b.txt c-99.txt renamed as c.txt
An example of replacing the extension:
$ rename -v 'y/\.txt/\.doc/' *.txt a-10.txt renamed as a-10.doc b-10.txt renamed as b-10.doc c-10.txt renamed as c-10.doc
REFERENCES
phoenixnap.com, how to rename files
NOTES
translating to uppercase
$ rename -v 'y/[a-z]/[A-Z]/' *.txt a.txt renamed as A.TXT b.txt renamed as B.TXT c.txt renamed as C.TXT
doing rename of git controlled files using parameter expansion
for i in *.txt; do echo git mv $i ${i/10/99}; done