Networking, Programming and Graphics Tutorials

How to rename multiple files in Linux/Unix shell [1/1]

Type: Code Networking, Programming and Graphics Tutorials
How to rename multiple files in Linux/Unix shell
Level: Beginner Networking, Programming and Graphics Tutorials 
How to rename multiple files in Linux/Unix shell
Date: 2007-Feb-10
How to rename multiple files in Linux/Unix shell
Visited: 2587 times
How to rename multiple files in Linux/Unix shell
Rating: How to rename multiple files in Linux/Unix shell
How to rename multiple files in Linux/Unix shell
Author: Tony Potter

This tutorial will show you how, with one raw command to rename multiple files using bash scripting.
It is written for Linux/Unix bash shell and will be useful when you want to rename files with same extension.

Here is the syntax of the string:

for i in * ; do mv "$i" `basename "$i" .ext1`.ext2 ; done
This line all will change all files with extension 'ext1' to 'ext2' .

The next example will convert all '.JPG' files to '.jpg' .It is really useful when you have moved files from Windows OS where the case of the extensions does not matter, but under Unix/Linux will be a problem if you are managing many files, like in galleries, photo albums etc.

for i in * ; do mv "$i" `basename "$i" .JPG`.jpg ; done
Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - How to rename multiple files in Linux/Unix shell [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: rename multiple files + UNIX shell  unix shell rename multiple files  rename multiple files in unix shell  rename multiple files unix in bourne shell  rename multiple files in one script unix shell  how to rename multiple files?+Unix shell script  linux shell rename multiple files  rename multiple files linux shell  how to rename multiple files in linux command shell  linux bash shell rename multiple files  unix shell on multiple files  changing multiple files unix shell  unix shell renaming multiple files  rename linux multiple shell  linux shell multiple rename  convert multiple files unix shell script  unix shell rename files  unix rename files shell  unix shell to rename files  rename files in unix shell