Move part of filename to another location

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Move part of filename to another location

Postby kazispeed » Sun Oct 28, 2018 9:42 am

Hi, I have a folder with thousands of photos and trying to do a bulk rename. Two examples below.

From: [Japan] Tokyo Holiday - A Day at Tokyo Disneyland 1
To: Tokyo Holiday - [Japan] A Day at Tokyo Disneyland 1

From: [Japan] Tokyo Holiday, Osaka Holiday - On The Shinkansen 1
To: Tokyo Holiday, Osaka Holiday - [Japan] On The Shinkansen 1

I have been trying to figure it out myself but really struggling, can someone please help me out? :(

Thanks in advance.
kazispeed
 
Posts: 3
Joined: Sun Oct 28, 2018 9:29 am

Re: Move part of filename to another location

Postby Emerkamp » Mon Oct 29, 2018 2:27 am

Hi,
Try this.

Regex (1)

Code: Select all
Match
(\[.*\]) (.*)( - )(.*)
Replace
\2\3\1 \4
Emerkamp
 
Posts: 140
Joined: Sat Aug 23, 2014 2:35 pm

Re: Move part of filename to another location

Postby kazispeed » Mon Oct 29, 2018 3:18 am

Wow that's perfect. Thank you so much @Emerkamp :D

Any chance you could explain what you did there? I'm trying to learn as much as I can so I can better understand how RegEx works.

Thanks again
kazispeed
 
Posts: 3
Joined: Sun Oct 28, 2018 9:29 am

Re: Move part of filename to another location

Postby Emerkamp » Mon Oct 29, 2018 5:15 am

Hi,
Sure, You're very welcome

Regex is a very powerful function inside BRU.

Basically what we did was break your string down into chunks or groups under the Match Section
" [Japan] Tokyo Holiday - A Day at Tokyo Disneyland 1 "
(\[.*\]) (.*)( - )(.*)

Then under the Replace Section We called these chunks of words/string back, Only in a different order
\2\3\1 \4

Go to the BRU help section, this explains the basic syntax used for my Regex Matching.
My main trick and to make it easy is to match by use of the wildcard (.*) whenever possible.

Their are whole websites to explain this and can get very deep, so try an keep it as simple as you can to start with.
Any other questions feel free to ask..
Emerkamp
 
Posts: 140
Joined: Sat Aug 23, 2014 2:35 pm

Re: Move part of filename to another location

Postby kazispeed » Mon Oct 29, 2018 7:13 am

Omg you make it sound so easy. Your explanation makes perfect sense.

Thank you so much @Emerkamp. Hope you have a wonderful week ahead. Take care :)
kazispeed
 
Posts: 3
Joined: Sun Oct 28, 2018 9:29 am


Return to BRU Support