Page 1 of 1

Find partial match file name and replace all file name

PostPosted: Wed Jul 03, 2019 10:44 am
by onnadaitaro
Hi...

Kindly help. i have a directory for all my movie files, I want to make the file name same as the cover file name (jpg). I put them all in one directory.

Example:
aqsh-011.mp4 need change to lorem ipsum2 - AQSH-011.mp4
baburu-007.mp4 need change to lorem ipsum3 - BABURU-007.mp4
BCDP-091.mp4 need change to lorem ipsum4 - BCDP-091.mp4
BF521.mp4 need change to lorem ipsum5 - BF-521.mp4
names_blk-332.mp4 need change to lorem ipsum6 - BLK-332.mp4
namos brk-06.mp4 need change to lorem ipsum7 - BRK-06.mp4

So in the same directory i already put files:
lorem ipsum2 - AQSH-011.jpg
lorem ipsum3 - BABURU-007.jpg
lorem ipsum4 - BCDP-091.jpg
lorem ipsum5 - BF-521.jpg
lorem ipsum6 - BLK-332.jpg
lorem ipsum7 - BRK-06.jpg

Kindly help what to do in the BRU interface.

Thanks B4

Re: Find partial match file name and replace all file name

PostPosted: Thu Jul 04, 2019 11:40 am
by therube
I put them all in one directory.

Are all the jpg/mp4 in 1 directory?
Or is each jpg/mp4 pair in its own individual directory.

DIR/ 1.jpg 1.mp4 2.jpg 2.mp4 3.jpg 3.mp4 ...

DIR1/ 1.jpg 1.mp4
DIR2/ 2.jpg 2.mp4
DIR3/ 3.jpg 3.mp4 ...

Re: Find partial match file name and replace all file name

PostPosted: Tue Jul 23, 2019 2:03 am
by onnadaitaro
yes. in one directory.

how to put these commands? sorry. I'm new using BRU.

Re: Find partial match file name and replace all file name

PostPosted: Tue Jul 23, 2019 2:05 am
by onnadaitaro
sorry. i missed you meaning.
it all in one directory:

DIR/ 1.jpg 1.mp4 2.jpg 2.mp4 3.jpg 3.mp4 ...

Re: Find partial match file name and replace all file name

PostPosted: Mon Jan 27, 2020 12:08 pm
by bru
BRC doesnt have that functionality, here's a batch for it:

@echo off
SetLocal EnableDelayedExpansion
For /f "delims=" %%A IN ('dir/b "* - *.jp*g"') DO (
(Set name=%%~nA) && (Set name=!name:* - =!)
For /f "delims=" %%B IN ('dir/b "!name!.mp*"') DO If not exist "%%~nA%%~xB" @echo @ren "%%B" "%%~nA%%~xB")
pause>nul

Run it with @echo to preview how it creates your rename-commands.
If it's what you're looking for, then remove @echo from the batch.