moving incremental characters in filenames

Bulk Rename Utility How-To's

moving incremental characters in filenames

Postby 78Staff » Tue Jul 23, 2024 11:48 pm

Seems like a lot of vloggers/youtubers like to put increments in thier video names, so you wind up with something like "Hiking the Pinhoti Trail Part 1 - A Fresh Start"... this plays havoc with emby trying to sort in some reasonable manner. But could be Day xx, or Chapter xx, etc, and also will not be in the same position every time.

Have searched back but haven't really found if/how BRU can handle this - Preferably I'd like to take the increment number as well as the preceding text and move it to the beginning of the filename. essentially turning

"Hiking the Pinhoti Trail Part 1 - A Fresh Start" into
"Part 1 - Hiking the Pinhoti Trail - A Fresh Start"

or
"Back on the Florida Trail! Florida Trail Day 57 [uvSFQS92J20]"
"Day 57 - Back on the Florida Trail! Florida Trail Day 57 [uvSFQS92J20]"

But having trouble since vloggers arent very consistent in thier naming, and not able to really get any traction with the copy/move settings

Any suggestions?
78Staff
 
Posts: 1
Joined: Tue Jul 23, 2024 11:37 pm

Re: moving incremental characters in filenames

Postby Admin » Wed Jul 24, 2024 1:01 am

Look at the RegEx (1) with Simple flag in BRU:

SIMPLE REGULAR EXPRESSIONS
Bulk Rename Utility 3.4 introduces Simple Regular Expressions, which can be enabled by switching on the option Simple in group RegEx (1).
Simple regular expressions work by matching text and then removing or rearranging the matched text.

The syntax is very simple, up to 9 matching tags can be used %1, %2, %3 until %9, which match a string of text. Examples:

Match: %1-%2

Replace: %2-%1

It will match first a string of text with %1 then the character '-' and then another string of text. It will then replace it with the second string of matched text, the character '-' and the first string of text matched. Effectively it will switch text around the character '-'.

Match: %1(%2)

Replace: %2

It will match first a string of text with %1 then a '(' and then another string of text followed by ')'. It will then replace it with the second string of matched text and the rest is dropped.

Match: %1-%2-%3 %4

Replace: %3-%2-%1 %4

It will match and reorder text such as '2020-03-12 Boston' into '12-03-2020 Boston'.

Match: %1%2%3%4

Replace: ABC%4

Replaces the first 3 characters with 'ABC'.

Up to 9 matching tags can be used : %1, %2, %3 until %9.

There are also 5 additional modifiers that can be used in the Replace string when Simple is used. These 5 modifiers are the same modifiers as when Simple is not used:

\U : Causes all subsequent characters to be output in upper case, until a \E is found.
\L: Causes all subsequent characters to be output in lower case, until a \E is found.
\E : Terminates a \L or \U sequence.
\l : Causes the next character to be outputted, to be output in lower case.
\u : Causes the next character to be outputted, to be output in upper case.

Examples:

Match: %1

Replace: \U%1

Capitalizes the name because %1 matches the whole name and \U%1 capitalizes it.

Match: %1_%2

Replace: \U%1\E_%2

Capitalizes the part of the name before _.

Match: %1_%2

Replace: \U%1\E_\L%2

Capitalizes the part of the name before _ and lowercases the part of the name after _.


Match: %1%2%3%4

Replace: \L%1%2%3\E%4

Lowercases the first 3 characters of a name.
Admin
Site Admin
 
Posts: 2926
Joined: Tue Mar 08, 2005 8:39 pm

Moving or adding words to the beginning

Postby Luuk » Thu Jul 25, 2024 1:31 pm

Also, must first decide which words should be moved (like Part 1) versus added to the beginning (like Day 57)?
Luuk
 
Posts: 811
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To