I'm trying to iterate through multiple folders and do something with the mp4 files in them, in one for
loop. The folder names are formatted like this:
Book 1; Water
Book 2; Earth
Book 3; Fire
So far I'm going through them manually:
@echo off
for /r %%i in ("Book 1; Water\*.mp4") do (
echo %%~ni
)
for /r %%i in ("Book 2; Earth\*.mp4") do (
echo %%~ni
)
for /r %%i in ("Book 3; Fire\*.mp4") do (
echo %%~ni
)
PAUSE
I prefer a method that reads out Book*\*.mp4
in one go. Is there any way to do this?
FOR /d /r "%sourcedir%" %%a IN ("Book*") DO (
FOR %%b IN ("%%a\*mp4") DO ECHO %%b
)
should produce your list of files - sourcedir
contains your starting directoryname.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments