get the processed filemane.

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

get the processed filemane.

Postby heyow » Tue Jun 26, 2012 2:15 pm

Hi,
first, thanks for BRU, really good cli rename program, exactly what I was searching for.

No problem with rename command, it works fine.

My problem is that I use BRU inside a big batch. And I need to get the processed filename to continue my batch. I can't find a way to get this filename.

Is there a way to get the filename that BRU generated ? A var or something ?

If not, I'll do it with some move and dir commands, but it would be cleaner to get the filename directly from BRU.

Thanks
heyow
 
Posts: 1
Joined: Tue Jun 26, 2012 2:07 pm

Filtering BRC output

Postby truth » Tue Aug 20, 2013 9:20 am

I dont think BRC makes internally-buffered-data avail as %EnvVar%
However, without /quiet, it always outputs OldName renamed to NewName
You just have the filter the leading-text to isolate NewName by itself

If you write alot of batches, I'd highly recommend sed for input/output filtering
Its a commandline editor that can also modify text inbetween pipes, etc!
Its regex match/replace is very similiar to BRC's /regexp, & perfect for such cases

As an example, the following batchline moves your renamed-files to C:\DirPath
BRC32 /parameters /execute|sed -n -r "s/.*renamed to (.*)/MOVE \"\1\" \"C:\\DirPath\\\1\"/p"|sed e
It matches NewName=\1, then creates & executes the command: MOVE "NewName" "C:\DirPath\NewName"
Note this happens on-the-fly, as each NewName is created - very fast & efficient

Another example, for those who only want to see which files would be renamed if using /execute:
BRC32 /parameters|sed -n -r "s/^Filename (.*)( would be renamed to )(.*)/\1 ---> \3/p"
OrigName1 ---> NewName1
OrigName2 ---> NewName2

You customize the output however you desire, & then output to wherever-you-want (if you want)
You can mod output to a file (to create undo-batches, etc) or just customize how stdout displays
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to BRC Support