LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Reinstating a files extension (https://www.linuxquestions.org/questions/linux-newbie-8/reinstating-a-files-extension-406006/)

Cripple 01-20-2006 09:34 PM

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.

damicatz 01-20-2006 09:42 PM

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.

nitinatindore 01-21-2006 06:50 AM

If you are using KDE than this is what you need:

"krename" command

Cripple 01-22-2006 04:12 PM

Cheers- that worked fine. Thanks for your help


All times are GMT -5. The time now is 05:12 AM.