

Prior to that, its pretty straightforward if you intend to rename a file in Ubuntu.
Mass rename ubuntu how to#
In this article, we would focus on how to rename multiple files in Ubuntu. But, at least you get an idea on how to move forward. It is not possible for us to cover each and every combination possible. In conclusion, we have covered how to rename multiple files in Ubuntu through few basic examples. What if we want to have underscore(_) in place of hyphen(-). In Case IV, we got files as tp-1.txt and tp-2.txt. Then, rename -v 's/techpiezo/tp/' *.txtĬase V. For instance, we have two text files – techpiezo-1.txt and techpiezo-2.txt and we would like these two as tp-1.txt and tp-2.txt. Rename part of filenames with another string. To convert upper case letters to lower case and vice versa in filenames- rename -v 'y/A-Z/a-z/' *Īs we have used a *, this would make changes to the all the files. If we want our files to not have an extension then, rename -v 's/\.txt$//' *.txtĬase III. To modify the extension to text file i.e.txt, issue the following – rename -v 's/\.odt$/\.txt/' *.odtĬase II. So, let’s say we have multiple document files which end with extension. We start with the easiest first, rename the extension of files. odt files.īesides, we also have -v option (Verbose) to view the modifications made – rename -v 's/\.odt$/\.txt/' *.odtĬase I. The above command would show us how things would look like but won’t make any material changes to the. To get that, use -n option, rename -n 's/\.odt$/\.txt/' *.odt This won’t make any changes to the files itself but, it would just show us what will be the outcome. This is important, before making changes we can also check how things will pan out for us.
Mass rename ubuntu install#
Next, to install rename package – sudo apt install rename Rename multiple files in Ubuntu Hence, open a terminal and issue the following – sudo apt update The package is available through standard Ubuntu repository. Besides, have a backup before you make any changes. In case you don’t have one then, we advise you to contact your System Administrator for assistance. Note: Following operations require superuser privileges. But, before that we need to install relevant packages. In this article, we cover how to rename multiple files with rename command-line utility in Ubuntu. Generally, we use a loop with mv command-line utility to rename multiple files. But, how changing the extension impacts the file is something we are not covering here. From here even the extension of the file can also be modified. It opens a dialog box to enter a new name. Through Graphical User Interface (GUI), we can easily rename a file.
