Only If - move 'The' from prefix to suffix

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Only If - move 'The' from prefix to suffix

Postby adelphiaUK » Mon Jun 09, 2025 5:23 am

Is there a method where you can execute B but only if A is true?

Changing the name of files or folders of a movie (or book, or music) with the prefix, "The", to a suffix, ", The" in addition to specifying where the suffix should go:

    1: The Flight of the Bumblebee (1900) to Flight of the Bumblebee, The (1900)
    2: The Land That Time Forgot (1974) to Land That Time Forgot, The (1974)
    3: The Grand Old Duke of York (Children's Nursery Rhyme; 1763–1827) to Grand Old Duke of York, The (Children's Nursery Rhyme; 1763–1827)
    4: Is This the Way to Amarillo (1972) remains Is This the Way to Amarillo (1972)
I hope the examples have shown what's intended and the fact it:
  • can only be actioned if the title's prefix is The (using RegEx /^(t|T)he */g) and only for said prefix and not subsequent mentions of 'The' or 'the'
  • can be placed anywhere within the file/folder's name by either:
    • specific location
    • before last instance of 'X' or
    • before last instance of 'X' less 'n' characters
    • cannot be 'n' characters from the end as list item #4 is different to list items #1, #2 and #3.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
adelphiaUK (Chris)
Please excuse misspellings and anything that may not make sense or cause offence as the medication I take can have an adverse effect on my mind.
adelphiaUK
 
Posts: 5
Joined: Sun Jun 08, 2025 7:30 am

Re: Only If

Postby adelphiaUK » Mon Jun 09, 2025 5:27 am

Can't find an edit button but the deliberate mistake was:

cannot be 'n' characters from the end as list item #3 is different to list items #1 and #2.
adelphiaUK
 
Posts: 5
Joined: Sun Jun 08, 2025 7:30 am

Re: Only If

Postby Admin » Mon Jun 09, 2025 6:22 am

Admin
Site Admin
 
Posts: 2923
Joined: Tue Mar 08, 2005 8:39 pm

Re: Only If

Postby adelphiaUK » Mon Jun 09, 2025 9:15 am



You're a bloody genius, so much so I could kiss you; just like an Italian kissing his Mamma! That's if I were Italian and you were my Mamma! So quick to respond and with such a perfect answer! I guess I'll have to think of something more challenging for my next, erm, challenge?

Which comes right now...

There is one more part to this quandary, and follows the exact same criteria. I hadn't included this before as I thought the solution was going to be a bit more challenging. Do you have a degree in RegEx, or do you use an online tool, like Reg101?

Anyway, the final instalment of this procedure; to do exactly the same on the initial folder and any corresponding children files/folders of that folder. Recursively.

Is that one a bit more challenging or should I just go grab a coffee??? Get this done and a purchase and donation will be coming your way (not much I'm afraid, as I'm disabled and on benefits).

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
adelphiaUK (Chris)
Please excuse misspellings and anything that may not make sense or cause offence as the medication I take can have an adverse effect on my mind.
adelphiaUK
 
Posts: 5
Joined: Sun Jun 08, 2025 7:30 am

Re: Only If

Postby Admin » Mon Jun 09, 2025 10:54 am

This is our tool you can use to create regular expressions for BRU :
https://www.bulkrenameutility.co.uk/js/?regex

To select all files also in subfolders in BRU select "subfolders" in Filters (12).
Admin
Site Admin
 
Posts: 2923
Joined: Tue Mar 08, 2005 8:39 pm


Return to Suggestions