This is what I've got so far:
Code: Select all
@echo off
for /f "tokens=*" %%P in ('DIR /B /O:N *.avi') do (
for /f "tokens=*" %%R in ('DIR /B /O:N *.srt') do (
ren %%R %%~nP.srt
)
)
It's obvious to me, why it doesn't work (every .srt file would be renamed to the name of the last .avi file in foler), however I have no more ideas how to solve it... I was thinking, if for could somehow take two parameters, like for /f "tokens=*" %%P in ('DIR /B /O:N *.avi') and %%R in ('DIR /B /O:N *.srt'), but that's not how for works unfortunately.
To give you a better idea about my files, here's what DIR /B /O:N *.avi/srt gives me:
Code: Select all
DIR /B /O:N *.avi
SeriesName.S04E01.avi
SeriesName.S04E02.avi
SeriesName.S04E03.avi
SeriesName.S04E04.avi
SeriesName.S04E05.avi
SeriesName.S04E06.avi
SeriesName.S04E07.avi
SeriesName.S04E08.avi
SeriesName.S04E09.avi
SeriesName.S04E10.avi
SeriesName.S04E11.avi
SeriesName.S04E12.avi
SeriesName.S04E13.avi
DIR /B /O:N *.srt
Series Name - 04x01.srt
Series Name - 04x02.srt
Series Name - 04x03.srt
Series Name - 04x04.srt
Series Name - 04x05.srt
Series Name - 04x06.srt
Series Name - 04x07.srt
Series Name - 04x08.srt
Series Name - 04x09.srt
Series Name - 04x10.srt
Series Name - 04x11.srt
Series Name - 04x12.srt
Series Name - 04x13.srt
Please help.