Renaming the end of a filename and put it to the beggining

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
iivi37
Junior Member
Junior Member
Posts: 3
Joined: 2023-04-20, 14:30 UTC

Renaming the end of a filename and put it to the beggining

Post by *iivi37 »

Hi guys,
can you please help me with multiple renaming documents in ttlcmd? I successfully found the part of the filename but I can't get back the rest of the filename. Please find below the example:

XY_111222333_Name j.k.l._A1.123.pdf
And I would like to get __A1.123__XY_111222333_Name j.k.l._A1.123.pdf

With _(\S{1,2})[.](\d{3,}) I can recognise the end of the document: _A1.123 which I want to put at the beginning of the new filename (bounded by __A123__) so it will looks like that.

But using __$1$2__ I get only the __A123__.pdf because it can't replace only this part of the filename but it effects the rest and I don't know what to add more...

Thank you a lot! in advance for you ideas

Best regards ;)
iivi37
Junior Member
Junior Member
Posts: 3
Joined: 2023-04-20, 14:30 UTC

Re: Renaming the end of a filename and put it to the beggining

Post by *iivi37 »

Hi!
I think I solved it ... by adding ."(.{1,})_(\w{1,2})[.](\d{3,})" which recognise the start of the filename... then call __$2$3__$1
But - if you have other idea, you can share it! :) Maybe it will helps someone in the future...

Br
User avatar
Dalai
Power Member
Power Member
Posts: 9964
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Renaming the end of a filename and put it to the beggining

Post by *Dalai »

Search for:

Code: Select all

(.+)_(\S{1,2}\.\d{3,})
Replace with:

Code: Select all

__$2__$1_$2
[X] RegEx

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
iivi37
Junior Member
Junior Member
Posts: 3
Joined: 2023-04-20, 14:30 UTC

Re: Renaming the end of a filename and put it to the beggining

Post by *iivi37 »

Hi Dalai,
thank you, it looks clenaer than my version.
Br,
iivi
Post Reply