Can I script BRU with batch or powershell?

Bulk Rename Utility How-To's

Can I script BRU with batch or powershell?

Postby ghaing » Sun Feb 28, 2021 10:10 am

I am renaming groups of scanned images in groups after each group is finished scanning. Because of the page numbers being in reverse for the "upside-down" second-side scan, the file names are either need to be incriments of +2 or -2.

The files in my folder are in one of two states.

Scenario A, gapped pages:
newscan_20210228_09042315
newscan_20210228_09042315
newscan_20210228_09042315
newscan_20210228_09042315
scan001_p001
scan001_p003
scan001_p005
scan001_p007

In this scenario I need to BRU the new scans (where filename > length 16) with arguments
1. remove right 17 characters
2. append numbering suffix with start number greater than the largest existing page and increments of -2

Scenario B, continuous pages:
newscan_20210228_09042315
newscan_20210228_09042315
newscan_20210228_09042315
newscan_20210228_09042315
scan001_p001
scan001_p002
scan001_p003
scan001_p004
scan001_p005
scan001_p006
scan001_p007
scan001_p008

In this scenario I need to BRU the new scans (where filename > length 16) with arguments
1. remove right 17 characters
2. append numbering suffix with start number greater than the largest existing page and increments of +2

There is also a Scenario C, where there are no renamed files yet (start of a new book scan) this will be determined by count (where filename < length 16) is zero.
This follows the same rename rule as Scenario B, with increments of +2

So far, bulk rename is already saving me tonnes of time (as it always does) doing this manually, but I always have to check the largest page number and remember to switch the increments between plus and minus 2. I want to script the above logic and then call BRU from powershell to run with the required arguments. Is this possible?

I could of course script the rename element itself in powershell, but to be honest, I'm not a coder, it taken me most of the morning to work out the first 2 lines I need and I've a long way to go yet. Also, as a result of this I'm also liable for scripting errors so I would rather rely on the renaming part to be executed by BRU. Can BRU be called from powershell or command line? I always assumed it could be but can't find any support for this online.

Sidenote: I've used this app for years, without scripting of course, and it is excellent software!!

Thanks
ghaing
 
Posts: 1
Joined: Sun Feb 28, 2021 9:55 am

Return to How-To