If you want to mass rename or bulk rename all the files in a folder in Ubuntu by replacing a part of the file name with another string, then use the bash script or command below. You can replace the extension “*.txt” in the command below with the extension of files you want to rename.

for i in *.txt; do mv "$i" ${i/find/replace};  doneCode language: Bash (bash)

For example, suppose you have file names like “Mydoc1.txt”, “Mydoc2.txt”, etc. And you want to change them to “Myfile1.txt”, “Myfile2.txt”, etc. Then the command would be

for i in *.txt; do mv "$i" ${i/doc/file};  doneCode language: Bash (bash)

Download HitXP Mobile App

Get it on Google Play