Rename-Tool; swap/switch position of words in file name

English support forum

Moderators: white, Hacker, petermad, Stefan2

_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Rename-Tool; swap/switch position of words in file name

Post by *_12345_ »

Hi to everyone...

I need to change names in multi files. :?
just swap/switch the first words to another position of the file name

EX;
i want to change this;

111 File-NAME 2012-01-15.rar
112 File-NAME 2012-01-25.rar
200 File-NAME 2012-03-05.rar
201 File-NAME 2012-04-10.rar
300 File-NAME 2012-04-19.rar

to this

File-NAME 111 2012-01-15.rar
File-NAME 112 2012-01-25.rar
File-NAME 200 2012-03-05.rar
File-NAME 201 2012-04-10.rar
File-NAME 300 2012-04-19.rar

Does anyone have any ideia in how to do this,... Please.
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Is File-NAME always the same amount of characters, and are the red numbers always 3 digits ?

If so, you can use the MultiRename tool (Ctrl+M) with this Rename mask for file name:

Code: Select all

[N4-14][N1-3][N14-]
otherwise it is more complicated
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Post by *_12345_ »

petermad wrote:Is File-NAME always the same amount of characters, and are the red numbers always 3 digits ?

If so you can use the MultiRename tool (Ctrl+M) with this Rename mask for file name:

Code: Select all

[N4-14][N1-3][N14-]
It's random,...
Could be numbers, letters, or both, and has not the same amount of characters.
_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Post by *_12345_ »

I know it's complicated,...
I've tried to do this using the [N#-#] and it only works well if the target to be changed has always the same number of characters.

But my problem is, with another list of files that has got random target to be changed
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

You probably cannot do it with the Rename mask if the Filename length is random - you have to use Search and replace with regular expressions. Is there ever any spaces in File-NAME? And you didn't ansver whether the red numbers are always 3 digits long?
Last edited by petermad on 2012-08-09, 14:01 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Post by *_12345_ »

petermad wrote:You probablycannot do it with the Rename mask if the Filename length is random - you have to use Search and replace with regular expressions. Is there ever any spaces in File-NAME? And you didn't ansver whether the red numbers are always 3 digits long?
Yes i have answered your question, immediately after yours,

..."It's random,... "...

Does not have the same amount of characters.

But,... Im doing this in another way, im grouping the files in separated folders, by the amount of the changing characters, so i can use the function [N#-#]
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

I thought "It's random" was referring to the length of File-NAME.

If the red numbers was always 3 digits then you could have used this:

[N4--11][N1-3][N-11-]

it will work with different length of File-NAME.
Last edited by petermad on 2012-08-09, 14:16 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Post by *_12345_ »

Thanks PETERMAD for your help :D
your drew my attention to this function [N#-#] :wink:
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

May be done using regex (checkbox): replace ([^ ]+) (.*)([^ ]*) with $2 $1$3. Works if space is used as word separator. Or replace ([^ ]+) (.*) ([^ ]*) with $2 $1 $3 if File-NAME may contain spaces.
_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Post by *_12345_ »

MVV wrote:May be done using regex (checkbox): replace ([^ ]+) (.*)([^ ]*) with $2 $1$3. Works if space is used as word separator. Or replace ([^ ]+) (.*) ([^ ]*) with $2 $1 $3 if File-NAME may contain spaces.
I saw where is the regex (checkbox).
But,... I do not understand where i have to run the change of ([^ ]+) (.*)([^ ]*) with $2 $1$3.
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

You put ([^ ]+) (.*)([^ ]*) in the "Search for:" field and you put $2 $1$3 in the "Replace with:" field, and check the box "RegEx"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
_12345_
Junior Member
Junior Member
Posts: 13
Joined: 2011-05-02, 12:16 UTC

Post by *_12345_ »

petermad wrote:You put ([^ ]+) (.*)([^ ]*) in the "Search for:" field and you put $2 $1$3 in the "Replace with:" field, and check the box "RegEx"
My dear friend ... This is a spectacularly magnificent. :mrgreen: :mrgreen:

I've done a better searching in HELP 'F1'
(where all of us rarely bother to use :oops: )
in;

OPERATIONS => Multi-rename tool => (click) Dialog Box - Multi-rename tool
then;
RegEx ... (click) regular expressions.

And it's all there, ... And it works like a charm, wonderful,
Now i just have to study it to better understand is concept.

Thanks a lot chum :mrgreen:
noxext
Junior Member
Junior Member
Posts: 4
Joined: 2022-08-11, 13:28 UTC

Re: Rename-Tool; swap/switch position of words in file name

Post by *noxext »

I have
a similar problem and applied the formula provided here but I get the
following result.
https://prnt.sc/auscW93qAart

on the example of the last product in the picture, I need the file name to
be from old name:Erba Vita Coli B sirup za decu 150 ml.jpg
to new name:Coli B sirup za decu Erba Vita 150 ml.jpg

Could you please help me with formula.
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Rename-Tool; swap/switch position of words in file name

Post by *Stefan2 »

noxext wrote: 2022-08-11, 15:56 UTC I have
a similar problem and applied the formula provided here but I get the
following result.
https://prnt#sc/auscW93qAart

on the example of the last product in the picture, I need the file name to
be from old name:Erba Vita Coli B sirup za decu 150 ml.jpg
to new name:Coli B sirup za decu Erba Vita 150 ml.jpg

Could you please help me with formula.


Hi and welcome.

FROM:
Erba Vita Coli B sirup za decu 150 ml.jpg
TO:
Coli B sirup za decu Erba Vita 150 ml.jpg

That is, match and re-order:
(Erba Vita) (Coli B sirup za decu) (150 ml).jpg
(Coli B sirup za decu) (Erba Vita) (150 ml).jpg

Match first two words, match next 5 words, match digits and "ml" and reorder for new name.
BUT: are all of your files named to that pattern? (two words, space, five words,......)




 
noxext
Junior Member
Junior Member
Posts: 4
Joined: 2022-08-11, 13:28 UTC

Re: Rename-Tool; swap/switch position of words in file name

Post by *noxext »

Hi,

Thank you on prompt replay

Pattern of all file names is Brand name + Name of the product + quantity. Some brands have 1 or even 4 words in their names, name of the product is very variable with words (I can try to count average number of words) and quantity is always number + measure.

I need to change order on this pattern Name of the product + Brand Name + quantity.
Post Reply