Mohammad Nair Aalam
Mohammad Nair Aalam

Reputation: 97

Using a batch script for only a few specified extensions

This is related to my earlier question Renaming my video files as per the resoltuion using batch

The final script was as:

@echo off & setlocal
cd X:\video\path
for /f "delims=" %%i in ('dir /b /a-d *.mp4') do (
    set "fnameo=%%~ni"
    set "fnamee=%%~xi"
    set "Height="
    for /f "delims=" %%j in ('mediainfo "--Inform=Video;%%Height%%" "%%~i"') do set "Height=%%j" 
    setlocal enabledelayedexpansion
    call set "selftest=%%fnameo:[H.264 !Height!p]=%%"
    if "!selftest!" equ "!fnameo!" if not exist "!fnameo! [H.264 !Height!p]!fnamee!" (
        rename "!fnameo!!fnamee!" "!fnameo! [H.264 !Height!p]!fnamee!"
    )
    endlocal
)

I find myself in a problem, it is that while the above script can only be used only for mp4 files most of my 480p videos are in flv format. Is there a way I could extend the same script to flv files. I know about wildcards, but I can't use them. Using 'star.*' would rename my *.bat file as well evreytime and I cannot possibly use '?'

Upvotes: 1

Views: 84

Answers (1)

Endoro
Endoro

Reputation: 37569

You can put more extensions in the for loop command, example:

for /f "delims=" %%i in ('dir /b /a-d *.mp4 *.flv *.mkv') do (

Upvotes: 4

Related Questions