Page 1 of 1

ignore files

Posted: 23 Nov 2010 00:52
by glob5
for /f "tokens=*" %%n in ('dir /s/b %1\*mydir*') do call :A1 "%%n"
:A1
pushd %~1
for %%D in (*myfile*.txt) do ( for /f "tokens=1 delims=+" %%H in ("%%~nD") do (
.. do stuff
goto do
)
)
:do
..do stuff
popd
:end

In the for %%D in .. line, how to skip "*myfile*.txt files that has the word "EPQ" in them?. :?:

Re: ignore files

Posted: 23 Nov 2010 19:38
by amel27
glob5 wrote:In the for %%D in .. line, how to skip "*myfile*.txt files that has the word "EPQ" in them?.

Code: Select all

for %%D in (*myfile*.txt) do (
  findstr "EPQ" "%%D">nul|| for /f "tokens=1 delims=+" %%H in ("%%~nD") do (
    echo %%H
  )
)


- "goto do" command interrupt FOR loop in first pass, only one file processed;
- each "CALL :SUB" command must be ended with GoTo:EOF in SUB procedure.