Name a srt file to match movie name within folder?

Bulk Rename Utility How-To's

Name a srt file to match movie name within folder?

Postby CHA0SENG7NE » Fri May 22, 2020 9:02 pm

Hi

Completely new to this software. Im trying to find a solution to rename srt (subtitle) file to match the video file in the same folder.

Can this software do this?

Many thanks for any guidance.
CHA0SENG7NE
 
Posts: 5
Joined: Fri May 22, 2020 8:58 pm

Re: Name a srt file to match movie name within folder?

Postby Admin » Sat May 23, 2020 3:55 am

Hello, please provide a few examples, from -> to (usually at least 5 examples would be useful) thanks
Admin
Site Admin
 
Posts: 2351
Joined: Tue Mar 08, 2005 8:39 pm

Re: Name a srt file to match movie name within folder?

Postby therube » Sat May 23, 2020 12:55 pm

Code: Select all
The 3 Stooges - New Malice.avi
3Stooges-NewMalice [EN-DVD].srt

Code: Select all
The 3 Stooges - New Malice.avi
The 3 Stooges - New Malice.srt
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Name a srt file to match movie name within folder?

Postby therube » Sat May 23, 2020 1:06 pm

JavaScript renaming, perhaps?

Rename-Pairs, perhaps?


The video file name & the .srt file name need not have commonality between them (like I've shown).
So you'd have to "pair" them up, in some manner.
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Name a srt file to match movie name within folder?

Postby CHA0SENG7NE » Sat May 23, 2020 1:23 pm

Sure here are a few examples I have...
I use emby server for my media so the corresponding subtitle usually an srt will need the movie file name plus language code.
For example..
Guardians of the Galaxy (2014) [1080p x264 AAC 5.1] [BluRay] [121mins].en.srt

I have a huge amount of srt that are labelled like this...

Movie file named

Frozen (2013) [1080p x265 AAC 5.1] [BluRay] [102mins].mp4

Srt's in same folder that arent recognised

Frozen (2013).eng [1080p x265 AAC 5.1] [BluRay] [102mins].srt

Frozen (2013) [ ] [102mins].eng.srt

For these to be recognised they would have to be named

Frozen (2013) [1080p x265 AAC 5.1] [BluRay] [102mins].eng.mp4

Hope that explains...

Thank you for getting back to me.
CHA0SENG7NE
 
Posts: 5
Joined: Fri May 22, 2020 8:58 pm

Re: Name a srt file to match movie name within folder?

Postby Admin » Sun May 24, 2020 3:26 am

Are these files all in the same folder? e.g. multiple movies and multiple subtitles files?
I think the best option would be to export all file names into Excel (select all the files you need in BRU, right click and select Clipboard Copy from the menu, then one of the formats).
Once the file list is in Excel use formulas to match files (like this cell value equal previous cell value) and create an Import Rename file to be imported in BRU and then rename them.
Admin
Site Admin
 
Posts: 2351
Joined: Tue Mar 08, 2005 8:39 pm

Re: Name a srt file to match movie name within folder?

Postby CHA0SENG7NE » Sun May 24, 2020 11:36 am

Thank you for the info
Each movie is in its own folder with the corresponding subtitle.
CHA0SENG7NE
 
Posts: 5
Joined: Fri May 22, 2020 8:58 pm

Re: Name a srt file to match movie name within folder?

Postby therube » Mon May 25, 2020 1:21 pm

(I'm not good with batch files...)


Since each movie/sub are in their own directory, you could use a batch file like:

Code: Select all
for  %%i  in (*.mp4 *.avi *.mpg *.flv)  do  rename  *.srt  "%%~ni.srt"


That should work when run within a particular directory.
Now if you were to get it to iterate down a directory tree...
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Name a srt file to match movie name within folder?

Postby CHA0SENG7NE » Mon May 25, 2020 9:58 pm

Thank you, I'll give that a try and report back.
If you have a moment to explain the code it would be appreciated. Seems like I have stumbled onto a very powerful and very well supported software!
Appreciated therube
CHA0SENG7NE
 
Posts: 5
Joined: Fri May 22, 2020 8:58 pm

Re: Name a srt file to match movie name within folder?

Postby therube » Wed May 27, 2020 4:53 pm

Basically, it looks for "video" files:
(*.mp4 *.avi *.mpg *.flv)
(adjust as needed)

At that point, it assumes it will find a .srt file in the same directory.
Then it renames said .srt - based upon the file name of the video file.

So if the video is
123.mp4
& the .srt is
abc.srt

it finds 123.mp4, the video file
the %~ni, says use the name portion of the filename - without the extension, so "123".

then it renames the .srt - no matter what it's current name is, to the (video) file name (as found above - without its' extension)

so, again "123", only it leave the existing .srt extension as it was
so "abc.srt" is renamed to 123.srt

& since 123.mp4 & 123.srt are both named the "same", when you play 123.mp4, the subtitles should then display, as expected. (And as you know, the file names, name part, exclusive of extension, of the video & the .srt must be the same for this to happen.)
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Name a srt file to match movie name within folder?

Postby CHA0SENG7NE » Wed May 27, 2020 10:01 pm

Thank you for taking the time, that is very helpful.
Its great to have a solution but understanding it is so much better.
Its just i have no idea how to implement this!

Im sorry

Is this for javascript renaming? Im so stuck!
CHA0SENG7NE
 
Posts: 5
Joined: Fri May 22, 2020 8:58 pm


Return to How-To