Page 1 of 1

Rename filename.jpg.jpg to filename.jpg

Posted: 01 Jul 2015 16:15
by clarkedesign
We've had a couple of thousand files from a client who has named them all incorrectly with a double extension of .jpg.jpg

How can we rename then from *.jpg.jpg to *.jpg

Search and replace cannot do this as it ignores extensions.

Re: Rename filename.jpg.jpg to filename.jpg

Posted: 01 Jul 2015 16:37
by bdeshi
well, one solution is, you could select all such files then do an EMPTY "Set Extension" rename
[if you keep it empty, the file extension is removed, so file.jpg.jpg becomes file.jpg]

Re: Rename filename.jpg.jpg to filename.jpg

Posted: 01 Jul 2015 16:49
by clarkedesign
Sammay - nice one - well done it worked perfectly :appl:

Re: Rename filename.jpg.jpg to filename.jpg

Posted: 01 Jul 2015 20:10
by Garonne
The "Batch Rename" function will remove (or change) extensions if you add the "/e" parameter at the end of the replacement text.

Re: Rename filename.jpg.jpg to filename.jpg

Posted: 02 Jul 2015 07:29
by autocart
clarkedesign wrote:How can we rename then from *.jpg.jpg to *.jpg

Search and replace cannot do this as it ignores extensions.
All of you,
are you not testing or proving a statement before you write it or comment on it?

I just renamed test.jpg.jpg successfully using the "search and replace" rename command using this pattern: ".jpg/"
Of course it works since the first ".jpg" in this case IS part of the base name, not of the extension!

Re: Rename filename.jpg.jpg to filename.jpg

Posted: 02 Jul 2015 07:41
by autocart
Garonne wrote:The "Batch Rename" function will remove (or change) extensions if you add the "/e" parameter at the end of the replacement text.
I want to emphasize for any other readers that, as you half way mentioned, this seems to be working only with "Batch Rename", but not with "Search and Replace".

In the example at hand to rename "test.jpg.jpg" to "test.jpg" do a "Batch Rename" with this pattern: "*/e" That's it.
help file wrote:Batch Rename Switches
/e for Extensions:
Note that the original file extensions remain unchanged. However there's an easy way to actually change the extensions: append /e to the pattern! The /e switch simply means: drop the original extension. Then it depends on the pattern whether a new extension is supplied or not.
::help "idh_menfile.htm#idh_menfilespecrename";

Despite all that, Sammay's solution is the most elegant, IMHO.

Re: Rename filename.jpg.jpg to filename.jpg

Posted: 08 Jul 2015 12:30
by AgarJames
Renaming File Extensions can be very handy when trying to "Rename" one file name to another. There are many programs on the web that can help you do this.

Here is easy and simple method

rename myfile.JPG->temp

and then

rename temp->myfile.jpg