Page 1 of 1

Can this be done in BRU? Swap parts of file name

PostPosted: Tue Jan 22, 2019 9:25 pm
by Renameo
Hi,
I've been rattling my brain in BRU and I'm not 100% sure what I'm trying to do is possible...

I have a bunch of files named as:

1513/28/07/16 - FILE02289 - UNEDITED.jpg
1625/29/07/16 - FILE02289 - UNEDITED.jpg

...and I need them renamed to:

FILE02289 - 1513/28/07/16 - UNEDITED.jpg
FILE02289 - 1625/29/07/16 - UNEDITED.jpg

I have some various other formats but they all follow the
same principle for example:

1153/15/09/16 - FILE03219 - EDITED - 19/10/16.jpg
0945/16/09/16 - FILE03269 - EDITED - 19/10/16.jpg

Changed to:
FILE03219 - EDITED - 1153/15/09/16 - 19/10/16.jpg
FILE03269 - EDITED - 0945/16/09/16 - 19/10/16.jpg

Does anyone know if this is even possible at all? I'm lost :cry:

Re: Can this be done in BRU?

PostPosted: Tue Jan 22, 2019 11:31 pm
by Emerkamp
Hi,

How do you have a / inside a filename. Isn't it an illegal char.

Either way, This will fix your 2 examples ONLY. It will take 2 steps.
The first step renames all files. Then the 2nd rename only touches the last example with 3 - hyphens.
RegEx (1)
Code: Select all
Match
(.*) - (FILE)(\d*) - (.*)
Replace
\2\3 - \1 - \4

This step only renames the longer filenames but can be run with all selected.
Code: Select all
Match
(FILE)(\d*) - (.*) - (EDITED) - (.*)
Replace
\1\2 - \4 - \3 - \5

Please test before renaming

Re: Can this be done in BRU?

PostPosted: Wed Jan 23, 2019 12:41 pm
by Renameo
Hi Emerkamp, thanks for taking the time to reply..

To answer your question.. This is because I am a noob and wrote out the examples as I wrote the post.. :oops:

..but I think I should have been more specific too..

My files don't have a point of ref within the file names. They are static but all follow the same priciples of:

"section of writing" - "section of writing" - "section of writing" .filename

So my problem can only be solved using the dashes as ref.. e.g everything up until one space after first - moved one space after the second -

Sorry, I should have written the examples with more thought.. some thing like:

022FD89 - TIM MARTIN BOAT SHOOT - TM7397.jpg
0327959 - PAUL GIELDS SESSION 24 - PG1489.jpg
7G6959 - TRACY ALLEN CARS - T159.jpg

...renamed to:

TIM MARTIN BOAT SHOOT - 022FD89 - TM7397.jpg
PAUL GIELDS SESSION 24 - 0327959 - PG1489.jpg
TRACY ALLEN CARS - 7G6959 - T159.jpg

or just as good ...renamed to:

TIM MARTIN BOAT SHOOT - TM7397- 022FD89.jpg
PAUL GIELDS SESSION 24 - PG1489 - 0327959.jpg
TRACY ALLEN CARS - T159 - 7G6959.jpg

Sorry again for not being clear...

Re: Can this be done in BRU?

PostPosted: Wed Jan 23, 2019 4:46 pm
by Emerkamp
Hi,

Ok, we'll try again.

If all your filenames start with a digit and has 2 - hyphens. Try this.
RegEx (1)
Code: Select all
Match
(\d.*) - (.*) - (.*)
Replace
\2 - \1 - \3

If not, but all filenames have 2 hyphens. Try this.
Code: Select all
Match
(^.*) - (.*) - (.*)
Replace
\2 - \1 - \3

Please test this first. If this doesn't work I'll need more examples. Say 6-10 of all different types.

Re: Can this be done in BRU?

PostPosted: Wed Jan 23, 2019 5:16 pm
by Renameo
Emberkamp... You are an absolute legend. 8)

The second one works perfectly and I was able to modify it for 3 hyphens..

I salute you... I was actually doing these one by one so you have literally saved me from days of torture.. Thankyou... :D

Re: Can this be done in BRU?

PostPosted: Thu Jan 24, 2019 2:27 am
by Emerkamp
Glad to see it worked. Nice, you were able to tweak it to your liking.
BRU help menu has a small cheat sheet for some more common used RegEx if you ever wanna try yourself.