Page 1 of 1

Find multiple strings

Posted: 31 Mar 2017 04:48
by Sounak@9434
So guys, I just downloaded a music pack from online yesterday. I extracted it and found 50 folders each with unique name and some with "!" name too. Inside each folder there is a separate audio and soundless video file. So to use external audio file using vlc I made a script.

Code: Select all

@echo off
for /f "tokens=*" %%z in ('dir /b') do (
   pushd "%%z"
   setlocal enabledelayedexpansion
   for /f "tokens=*" %%a in ('dir /b^|find ".mp3"') do set "msc=%%a"
   for /f "tokens=*" %%b in ('dir /b^|find ".avi"') do set "vid=%%b"
   if "!msc!" neq "" (
      if "!vid!" neq "" ("C:\Program Files\VideoLAN\VLC\vlc.exe" -f "!vid!" --input-slave="!msc!" vlc://quit) ELSE ("C:\Program Files\VideoLAN\VLC\vlc.exe" "!msc!" vlc://quit)
   )
   endlocal
   popd
)

The problem is that some music files are in *.ogg and some video files are in *.mp4
So how can I create a find command that will search for multiple strings. I don't want to create two separate find command as each folder contains many files and this will kill the performance. Maybe this would also work, if a find is successful it terminates the other one from use.

And as a side request, does anyone knows any command line utility that can join music file with video file?

Re: Find multiple strings

Posted: 31 Mar 2017 08:09
by ShadowThief
Don't use find at all; dir can handle multiple wildcards.

Code: Select all

for /f "tokens=*" %%a in ('dir /b *.mp3 *.ogg') do set "msc=%%a"
for /f "tokens=*" %%b in ('dir /b *.avi *.mp4') do set "vid=%%b"

Re: Find multiple strings

Posted: 13 Apr 2017 14:25
by Samir
As far as the command line video/audio program, I believe ffmpeg has options for this.