Renaming / swap in file name.

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
rsje97
Junior Member
Junior Member
Posts: 3
Joined: 2018-02-27, 13:21 UTC

Renaming / swap in file name.

Post by *rsje97 »

Hi TC-experts!

I have a bunch of files I need to rename. In the filename, I need to extract a specific string (5 numbers followed by xx) and put it into the beginning of the file, e.g.

(current name -> new name)

blablabla12345xxblablabla.jpg -> 12345xxblablablablablabla.jpg

bla98765xxblablabla.jpg -> 98765xxblablablabla.jpg

I guess this is a RegEx thing and I haven't been able to find the right way to do this. Can anyone help with the correct search/replace?

All the best,

Rasmus
User avatar
Stefan2
Power Member
Power Member
Posts: 4189
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Renaming / swap in file name.

Post by *Stefan2 »

FROM:
ABCDEF12345xxGHIJK.jpg
XYZ98765xxMNOPQ.jpg

TO:
12345xxABCDEFGHIJK.jpg
98765xxXYZMNOPQ.jpg


USE MRT:
Search: (.+)(\d{5}xx)(.+)
Replace: $2$1$3
[x]RegEx



 
rsje97
Junior Member
Junior Member
Posts: 3
Joined: 2018-02-27, 13:21 UTC

Re: Renaming / swap in file name.

Post by *rsje97 »

Fantastic - thanks Stefan2!
Post Reply