We know this works and works well from the commnd-line... Ref. Using forfiles with multiple file types for search mask?
for %G in (fileone, filetwo) do forfiles /P D:\hold\logs /M *.%G.* /C "cmd /c echo @path"
What we want to do is to use these two file masks: fileone and filetwo to CALL to another FORFILES and with the doubled up %%G this is now in a batch script.. I would suppose we could probably do both of these operations at one time?
SET SOMELOGS=D:\hold\logs
for %%G in (fileone, filetwo) do forfiles /P %SOMELOGS% /M *.%%G.* /C "cmd /c ECHO @path & call :locate @path"
:locate
echo somepath %%1
FOR /f "tokens=1-9 delims=/: " %aa IN ('forfiles /P "%SOMELOGS%" /M %%1 /D -1 /C "cmd /c echo @file @fdate @ftime"') DO call :ZIP %%a %%b %%c %%d %%e %%f %%g
:ZIP
PAUSE
results are:
"D:\hold\logs\server.fileone.log.2013-12-14.a"
Invalid attempt to call batch label outside of batch script.
"D:\hold\logs\server.fileone.log.2013-12-15.a"
Invalid attempt to call batch label outside of batch script.
"D:\hold\logs\server.fileone.log.2013-12-15.b"
Invalid attempt to call batch label outside of batch script.
"D:\hold\logs\server.fileone.log.2013-12-16.a"
Invalid attempt to call batch label outside of batch script.
This does not seem to work either.. Cannot use: /c more than one time... Ref..nested forfiles: path and extension filter
SET SOMELOGS=D:\hold\logs
for %%G in (fileone, filetwo) do forfiles /p %SOMELOGS% /m *.%%G.* "forfiles /p @path /M %%1 /D -1 /C "cmd /c echo @file @fdate @ftime"') DO call :ZIP %%a %%b %%c %%d %%e %%f %%g
:ZIP
PAUSE