Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-20-2006, 09:34 PM   #1
LQ Newbie
Registered: Oct 2005
Location: New Zealand
Distribution: Debian 3.1, College Linux
Posts: 12

Rep: Reputation: 0
Reinstating a files extension

I am dual booting linux with WinXP. I was/am storing a large amount of digital images (100+ images from camera) in linux, where I decided to rename all the files. The file names started off as something like image09.jpg where I would rename it as something like House. But in the process of renaming it, the file extension (.jpg or suchlike) was deleted. Linux didn't mind this, and still recognised the file as an image. But when I try to load the images back into XP, it doesnt recognise the file as being an image and so gives it an extension of FILE.

By renaming the image (in XP) with .jpg on the end, XP will recognise it. Same happens if I load the file into an image viewer. But renaming the file with the extension .jpg (or whatever) is time consuming and annoying.

Is there a way in linux to reinstate the file extension without having to go through and rename the images? Or does anyone no of any way of doing the same in XP? Any help will be much appreciated and I hope what I have written makes sense.
Old 01-20-2006, 09:42 PM   #2
Registered: May 2004
Distribution: FreeBSD 7, Debian "Squeeze", OpenBSD 4.5
Posts: 167

Rep: Reputation: 30
This should do the trick :
for X in *; do mv $X $X.jpg; done

Make sure you run it only in the directories where the files are you wish to rename. Running it in a directory that has stuff you do not want to have a .jpg extension would be a bad thing as it will add .jpg to everything in the current directory.

Last edited by damicatz; 01-20-2006 at 09:47 PM.
Old 01-21-2006, 06:50 AM   #3
Registered: Dec 2004
Location: India
Distribution: Mandrake, Mandriva, PclinuxOS
Posts: 114

Rep: Reputation: 15
If you are using KDE than this is what you need:

"krename" command
Old 01-22-2006, 04:12 PM   #4
LQ Newbie
Registered: Oct 2005
Location: New Zealand
Distribution: Debian 3.1, College Linux
Posts: 12

Original Poster
Rep: Reputation: 0
Cheers- that worked fine. Thanks for your help


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
remove all files with same extension? scratchnz Linux - General 1 11-04-2005 03:40 AM
Extension files BC1 Linux - Software 5 12-20-2004 03:41 AM
What to do about these files with .new extension? Slovak Slackware 1 11-23-2004 04:50 PM
How program to read files with extension .dat y .cfg files COMTRADE in fedora 1? ivonne Linux - Software 0 11-22-2004 11:42 AM
Reinstating LILO lectraplayer Linux - Software 3 04-18-2004 05:47 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration