How 2 rename al the files with same extension

Solved/Closed
idiot - Jun 28, 2009 at 01:50 PM
Tom6
Posts
142
Registration date
Friday July 31, 2009
Status
Member
Last seen
August 7, 2009
- Aug 5, 2009 at 05:21 AM
Hello,
hai i want rename all the files which has an extension of .gif to .jpg using shell client......please help us...
thanks in advance

2 replies

for files in *.gif
do
   mv "$files" "${files%.gif}.jpg"
done 
0
Tom6
Posts
142
Registration date
Friday July 31, 2009
Status
Member
Last seen
August 7, 2009
16
Aug 5, 2009 at 05:21 AM
Hi :)

While linux tends to be able to ignore file extensions and correctly identify the correct coding of a file any Windows users will be completely stuck trying to open these renamed files. ".gif" and ".jpg" are very different ways of compressing an image requiring quite different decoding mechanisms. If you use Gimp or something similar then doing 2Save As ..." and changing the file-extension is enough to make Gimp (or whichever) translate the picture from one format to another. Simply changing the file-extension through a bash-script will not (afaik)

https://www.gimp.org/docs/

Gimp is probably included in the standard install of whichever flavour of linux you have installed
Good luck and regards from
Tom :)
0