How moving a miscellaneous text fragment in many files

Bulk Rename Utility How-To's

How moving a miscellaneous text fragment in many files

Postby Vivec999 » Tue Jun 22, 2021 11:56 pm

Hello
I have a huge request for help with the following problem: How moving a miscellaneous text fragment in many files at the same time

I would like to shift the given text included between the following constant expressions: "_" and "-" in the middle of the name (each directory has different text between these characters). I want to move this text to the end of the directory / file name. Of course, I want to move this different part of the name in dozens of folder names at once.
Below is an example of the name in the original and target versions

original:
1. [Africa] - 2017-01-03_Follow-Me-Sudan-Kira
2. [Africa] - 2017-01-04_Trele-Me-Sudan-Kira
target versions:
1. [Africa] - 2017-01-03Me-Sudan-Kira_Follow-
2. [Africa] - 2017-01-04Me-Sudan-Kira_Trele-

thank you very much for help

Vivec
Vivec999
 
Posts: 2
Joined: Tue Jun 22, 2021 11:26 pm

Re: How moving a miscellaneous text fragment in many files

Postby Luuk » Wed Jun 23, 2021 3:41 am

Greeting Vivec. There is many ways, but the Filters(12) should always have checkmarks in 'Folders' and 'SubFolders'.
Then inside of the Regex(1), there can be many different 'Match' and 'Replace' like ...

^(\[.+?\] - \d{4}-\d\d-\d\d)(_.+?-)(.+)
\1\3\2

(.+)(_.+?-)(.+)
\1\3\2

Or with a checkmark in 'Simple', it can be like...
[%1] - %2_%3-%4
[%1] - %2%4_%3-

%1_%2-%3
%1%3_%2-

There is other ways also, like using Remove(5) with Crop=Special and using _*- to remove the text.
Then Add(7) can add it back to the filename by putting <removed> inside for the 'Suffix'.
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm

Re: How moving a miscellaneous text fragment in many files

Postby Vivec999 » Wed Jun 23, 2021 7:30 pm

Hello
Thank you very much for help.
I tried the proposed solutions, I was successful with the solution below:

Or with a checkmark in 'Simple', it can be like...
[%1] - %2_%3-%4
[%1] - %2%4_%3-

%1_%2-%3
%1%3_%2-

The remaining solutions, unfortunately, have not fully understood how to apply them.

If we could explain these examples even more precisely, I would be very grateful

Thank you again
Vivec999
 
Posts: 2
Joined: Tue Jun 22, 2021 11:26 pm

Re: How moving a miscellaneous text fragment in many files

Postby Luuk » Wed Jun 23, 2021 11:24 pm

Im not understanding which examples to explain more precisely, so trying to descibe them all, but really the manuals are best.

The 'simple' expressions use %Number# to match "groups of text", so you can rearrange them inside of the 'Replace' box.
The more characters in 'Match', the more prejudice your matches can be, since %# matches any "group of text" until the next character in your Match.
But everything inside 'Match' must always be retyped into 'Replace' if you decide to keep it.

The others use (expression) to match (groups of text), so you can rearrange them with \1, \2, \3, etc inside of the 'Replace' box.
Since expression can be very descriptive, its often better than using 'Simple' with %#, because this only matches by "simple bordering characters".
The first example used \d{4} to say Any4Numbers, but its also more complicated, because needing "\[" to say "[", and also "\]" to say "]".

So if all the filenames is like your description, its best using the very first example without a checkmark in Simple...
^(\[.+?\] - \d{4}-\d\d-\d\d)(_.+?-)(.+)
\1\3\2

^(\[.+?\] - \d{4}-\d\d-\d\d) so \1 = Anything starting as [1-or-MoreCharactersUntil] - 4Numbers-2Numbers-2Numbers
(_.+?-) ...................... so \2 = _1-or-MoreCharactersUntil-
(.+) ......................... so \3 = 1-or-MoreCharacters



With 'Simple', if all the years started with "20", the most prejudice you can be, would be something like...
[%1] - 20%2-%3-%4_%5-%6
[%1] - 20%2-%3-%4%6_%5-

Each %# matches "1-or-more characters" beside its simple bordering characters in the match, but they cannot verify if its a number, or anything else.
So theres really no way for %2, %3, %4 to know if their "1-or-more characters" is actually "2numbers" or "4numbers" or "100characters".
But really its still good enough for most people, it just depends on how many filename formats are inside of your file-listing.
And often, your file-listing can be fixed with the 'Mask' inside of Filters(12) anyways.
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To