Networking, Programming and Graphics Tutorials

Renaming multiple files with same extension [1/1]

Type: Code Networking, Programming and Graphics Tutorials
Renaming multiple files with same extension
Level: Beginner Networking, Programming and Graphics Tutorials 
Renaming multiple files with same extension
Date: 2007-Feb-10
Renaming multiple files with same extension
Visited: 457 times
Renaming multiple files with same extension
Rating: Renaming multiple files with same extension
Renaming multiple files with same extension
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 - Renaming multiple files with same extension [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: Renaming Multiple Files with the Same Extension linux  unix renaming multiple files only extension  renaming all files in an extension unix  renaming multiple files in linux with mv  linux renaming multiple files  renaming multiple files + Unix  unix renaming multiple files  renaming multiple files linux #1  renaming multiple files unix'  renaming multiple linux files  renaming multiple files unix  renaming multiple files using mv in linux  renaming multiple files in unix  renaming multiple files in bash  renaming multiple files linux  renaming multiple files in linux  renaming multiple files in ssh shell  rename multiple files to same extension  rename multiple files with the same extension  rename extension multiple files mv