Rename filename.jpg.jpg to filename.jpg

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
clarkedesign
Posts: 69
Joined: 14 Feb 2013 09:29

Rename filename.jpg.jpg to filename.jpg

Post 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.
Thanks,
Sean Clarke

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

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

Post 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]
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

clarkedesign
Posts: 69
Joined: 14 Feb 2013 09:29

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

Post by clarkedesign »

Sammay - nice one - well done it worked perfectly :appl:
Thanks,
Sean Clarke

Garonne
Posts: 116
Joined: 21 Apr 2015 19:10
Location: Germany
Contact:

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

Post by Garonne »

The "Batch Rename" function will remove (or change) extensions if you add the "/e" parameter at the end of the replacement text.

autocart
Posts: 1248
Joined: 26 Sep 2013 15:22

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

Post 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!
Last edited by autocart on 02 Jul 2015 07:43, edited 1 time in total.

autocart
Posts: 1248
Joined: 26 Sep 2013 15:22

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

Post 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.

AgarJames
Posts: 1
Joined: 08 Jul 2015 12:17

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

Post 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

Post Reply