Renaming / swap in file name.
Moderators: Hacker, petermad, Stefan2, white
Renaming / swap in file name.
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
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
Re: Renaming / swap in file name.
FROM:
ABCDEF12345xxGHIJK.jpg
XYZ98765xxMNOPQ.jpg
TO:
12345xxABCDEFGHIJK.jpg
98765xxXYZMNOPQ.jpg
USE MRT:
Search: (.+)(\d{5}xx)(.+)
Replace: $2$1$3
[x]RegEx
ABCDEF12345xxGHIJK.jpg
XYZ98765xxMNOPQ.jpg
TO:
12345xxABCDEFGHIJK.jpg
98765xxXYZMNOPQ.jpg
USE MRT:
Search: (.+)(\d{5}xx)(.+)
Replace: $2$1$3
[x]RegEx
Re: Renaming / swap in file name.
Fantastic - thanks Stefan2!
-
- Junior Member
- Posts: 77
- Joined: 2018-03-28, 20:13 UTC
Re: Renaming / swap in file name.
I'm trying something similar, trying to replicate/adapt/learn from this example... and failing!
I have folders that are named:
YYYY.MM.DD AM Week
(Where "AM Week" is standard text. Literally, two initials followed by " Week")
And I want to use MRT to name them
AM Week (YY-MM-DD)
And am finding it most vexing!
I have folders that are named:
YYYY.MM.DD AM Week
(Where "AM Week" is standard text. Literally, two initials followed by " Week")
And I want to use MRT to name them
AM Week (YY-MM-DD)
And am finding it most vexing!
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Re: Renaming / swap in file name.
2Alonzo Mosley
You don't need regex for that. Just put:
in the "Rename mask: file name" field and clear the "Extension" field
I am using the last two digits from the YYYY part
You don't need regex for that. Just put:
Code: Select all
[A11-] ([A3-4]-[A6-7]-[A9-10])
I am using the last two digits from the YYYY part
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
-
- Junior Member
- Posts: 77
- Joined: 2018-03-28, 20:13 UTC
Re: Renaming / swap in file name.
[A11-] Takes everything from the 11th to the last position in the original and puts it first
[A3-4] Takes the third and fourth character from the original and puts it after the open paren
and so on.
Exactly.
Instead of [A11-] you could also use [A-7-] which takes the 7 last characters in the name.
I am using A instead of N (and E in the "Extension" field) because of the multiple periods in the name - otherwise TC treats .DD AM Week as the extension
[A3-4] Takes the third and fourth character from the original and puts it after the open paren
and so on.
Exactly.
Instead of [A11-] you could also use [A-7-] which takes the 7 last characters in the name.
I am using A instead of N (and E in the "Extension" field) because of the multiple periods in the name - otherwise TC treats .DD AM Week as the extension
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
-
- Junior Member
- Posts: 77
- Joined: 2018-03-28, 20:13 UTC
Re: Renaming / swap in file name.
OK. Here's the more important question:
How did you get YOUR reply to appear embedded in MINE???!?!??!?
Image: https://i.ibb.co/DfC2K3T/Screenshot-2024-07-09-102119.png
How did you get YOUR reply to appear embedded in MINE???!?!??!?
Image: https://i.ibb.co/DfC2K3T/Screenshot-2024-07-09-102119.png
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Re: Renaming / swap in file name.
Sorry - It's because I am a moderator - I accidentally had hit the Edit button instead of the Reply button.Alonzo Mosley wrote: 2024-07-09, 17:17 UTC OK. Here's the more important question:
How did you get YOUR reply to appear embedded in MINE???!?!??!?
Image: https://i.ibb.co/DfC2K3T/Screenshot-2024-07-09-102119.png
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
-
- Junior Member
- Posts: 77
- Joined: 2018-03-28, 20:13 UTC
Re: Renaming / swap in file name.
Did. Not. Know. Mods. Could. Edit. Other's. Posts.
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.