I have this code
for /R "C:\myfiles" %%i in (*super*.ts) do (
echo %%i
)
so I want to iterate over all files in the folder C:\myfiles
which have in the path super
and end with .ts
. e.g.
"c:\myfiles\foo\bar\super\123.ts"
but that substring search doesn't work.
What about this:
dir /S /B C:\myfiles\*.ts | findstr /I "Super"
Explanation:
dir /S : search in subdirectories
dir /B : show bare format, like C:\myfile\subdir\filename.ts
...
findstr /I : filter is case insensitive
result:
for /f "delims=" %%a in ('dir /S /B C:\myfiles\*.ts ^| findstr /I "Super"') do echo %%a