Custom batch replacement

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

Custom batch replacement

Postby mrmakrelli » Fri Feb 03, 2017 3:36 pm

Hi there, I'm quite new to using BRU, but it's so far been going quite well. I've hit a bit of a wall at the moment though. I need to replace a batch of files with custom information, and have it set so that I can reuse it at a later point.

For example, I need the following:

file-001.wav
file-002.wav
file-003.wav
...

To be:

file_24_C0.wav
file_27_D#0.wav
file_30_F#0.wav
...

There pattern isn't consistent, but I do have a template, and I need to apply this to many files that have the same suffixes. I basically want to be able to match and replace all files that have '-001' with '24_C0', all files with '-002' with '27_D#0' etc. I'm guessing I can set up a little script using RegEx, but it doesn't seem to be doing what I want it to do.

Any help would be greatly appreciated!
mrmakrelli
 
Posts: 3
Joined: Fri Feb 03, 2017 3:30 pm

Re: Custom batch replacement

Postby Admin » Sat Feb 04, 2017 12:36 am

Under "actions" in BRU there is a functionality called "import rename pairs". It allows you to create a list of renaming pairs in Excel for instance then import it in BRU. See help file for more info. thanks
Admin
Site Admin
 
Posts: 1554
Joined: Tue Mar 08, 2005 8:39 pm

Re: Custom batch replacement

Postby mrmakrelli » Sat Feb 04, 2017 12:56 am

Thanks for the reply, I did look into this but I can't seem to figure it out. My problem is that there are a few files that end in -001.wav, for example:

LDS-001.wav
PPR-001.wav
...

and I need them all to be updated, so the prefixes aren't all consistent. Sorry if I'm missing something very obvious. The help file seems to suggest that you can only do exact name changes.
mrmakrelli
 
Posts: 3
Joined: Fri Feb 03, 2017 3:30 pm

Re: Custom batch replacement

Postby Admin » Sat Feb 04, 2017 1:43 am

What is the complete list of replacements you need to do? e.g.

-001 with 24_C0
-002 with 27_D#0

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

Re: Custom batch replacement

Postby mrmakrelli » Sat Feb 04, 2017 11:57 am

-001.wav|24_C0.wav
-002.wav|27_D#0.wav
-003.wav|30_F#0.wav
-004.wav|33_A0.wav
-005.wav|36_C1.wav
-006.wav|39_D#1.wav
-007.wav|41_F1.wav
-008.wav|44_G#1.wav
-009.wav|47_B1.wav
-010.wav|50_D2.wav
-011.wav|53_F2.wav
-012.wav|56_G#2.wav
-013.wav|59_B2.wav
-014.wav|62_D3.wav
-015.wav|65_F3.wav
-016.wav|69_A3.wav
-017.wav|71_B3.wav
-018.wav|74_D4.wav
-019.wav|76_F4.wav
-020.wav|78_G4.wav
-021.wav|82_A#4.wav

For now, I've just set up a massive text document with all possible permutations, but in future, I'd prefer a more elegant system if it was possible.
mrmakrelli
 
Posts: 3
Joined: Fri Feb 03, 2017 3:30 pm

Re: Custom batch replacement

Postby Admin » Mon Feb 06, 2017 2:24 am

So you can setup all the replacements needed that you listed above in a Javascript function (see Special (14)).
Then all the replacements on all files also in subfolders can be done with 1 click. If you need help next time please post here.
thanks
Admin
Site Admin
 
Posts: 1554
Joined: Tue Mar 08, 2005 8:39 pm

Re: Custom batch replacement

Postby VisualizersLL » Tue Nov 27, 2018 2:06 pm

Hello, I wanted to achieve kind of the same thing recently.
I have no knowledge of javascript.
However what i want to achieve i think could only be done using javascript.
Basically i have a long list of files; example;

file.0000.png
file.0001.png
file.0002.png
etc

and i want it to be changed to

file.222.png
file.394.png
file.023.png
etc

what i mean is, every file which has a "0000" should be changed to "222"
every file which has a "0001" has to become "394" and "0002" to "023"
This has to be applied to many files, inside many folders but which follow the same pattern.
Thing is using the .txt way of listing wouldn't do, because in one folder files are named file.arms.0000.png and in another folder they are called file.body.0000.png
So the names aren't the same, but the number pattern i need, would be exact same in every folder.
So i would need something that can see, if "0000" found change to "222" and etc on the orders.

How would I go to achieve this? Thanks in advance. :)
VisualizersLL
 
Posts: 2
Joined: Tue Nov 27, 2018 1:56 pm

Re: Custom batch replacement

Postby Admin » Tue Nov 27, 2018 11:10 pm

You could do this with multiple passes (replacing one each time), or in Javascript it can be done with 1 pass by putting all the replacement pairs in the script.
Admin
Site Admin
 
Posts: 1554
Joined: Tue Mar 08, 2005 8:39 pm

Re: Custom batch replacement

Postby VisualizersLL » Wed Nov 28, 2018 3:06 pm

Sure i get the replacement pairs bit, the problem is i have other folders where i need to apply these same new numbers to the same number list, but the file have different names. So i would like to not have to make a list of replacement pairs for each folder.

folder 1:

filebla.0000.png
filebla.0001.png
filebla.0002.png

folder 2:

filemaximus.0000.png
filemaximus.0001.png
filemaximus.0002.png

etc.

So if i could learn to make some script for the bulk rename java, that lets me chose the numbers i want to change to which number, but completely individually from the previous name characters and lenght, i think that would solve it. :?:
VisualizersLL
 
Posts: 2
Joined: Tue Nov 27, 2018 1:56 pm


Return to Javascript Renaming