Renaming multiple parts always seems a difficult job and renaming can be done only senior system administrator. Actually it is very easy as long as the situation is not so complex.
Rename Command
Rename command will change files names according to the rules specified. Rename command also supports perlexpr. Rename is also known with rename.ul in some distributions but recently rename command can be used.
$ rename ".jpg" ".jpeg" "*.jpg"
- Rename files specified *.jpg and change .jpg to the .jpeg
Change Uppercase Filenames To Lowercase
Another useful usage of rename is converting names to upper and lowercase we will see in this example how to convert uppercase to lowercase
$ rename 'y/A-Z/a-z/' *
Change Lowercase File Names To Uppercase
In contrast to the previous example, we will convert lowercase names to the uppercase during the rename operation.
$ rename 'y/a-z/A-Z/' *
Using Mmv
mmv
is another command used to move, copy, append and link multiple files with wildcard patterns. Mmv makes these operations safely without harming any files. Mmv supports big files but don does not support sparse files for append. mmv
stands for Multi Move
$ mmv '*.jpeg' '#1.jpg'
- *.jpeg is the files those will be selected for rename
- #1 is the name part of the files select and do not includes the extension
- .jpg is the extension will be added
