I'm trying to match files in a batch file, that contain the pattern .log.
in the name but do not end in .log
.
I have tried to match files with the following command:
dir *.log.*
This matches all that contains .log
even if it is at the end. I've also tried with the following pattern:
*\.log\.*
, but the compiler looks for a path, which is not intended.
I would appreciate some help, thank you in advance!
CodePudding user response:
You can combine a FOR
loop with an IF
statement
read HELP FOR
and HELP IF
and then try something like this in the command prompt
@for %a in (*.log.*) do @if /i not "%~xa"==".log" @echo %a
and then add it to your batch file
for %%a in (*.log.*) do (
if /i not "%%~xa"==".log" (
echo %%a
)
)