Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to skip files in a fileset?

Oct
31
0
I know that I can skip lines at the beginning of a FILE before parsing the remainder of the FILE with:
Code:
FOR /F "skip=1000" %i IN (fileset.txt) ...
The fileset.txt FILE contains a list of filenames, created earlier with a DO- or FOR-loop.

Instead of using a FILE, can skipping files be done directly within a FILESET?
Code:
DO i IN /S *.* ...
or
Code:
FOR /R %i IN (*.*) ...
 
Look at Exclusion ranges. For example,

Code:
for /[!*.btm *.bat] %x in (*.*) ...
 
You just want to skip the first 1000 matches?

Code:
set n=0
do file in /s *
    set n=%@inc[%n]
    if n le 1000 iterate

    rem Do stuff ...
enddo
 
You just want to skip the first 1000 matches?

Code:
set n=0
do file in /s *
    set n=%@inc[%n]
    if n le 1000 iterate

    rem Do stuff ...
enddo
Or even :-)
Code:
do file in /s *
    if %_do_loop le 1000 iterate
    rem Do stuff
enddo


You can build any test into the body of DO or FOR ... with wildcards or regexes
Code:
do f in *
    if %@wild[%f,*.bat] == 1 iterate
    if %@regex[.*\.bat,%f] == 1 iterate
    rem Do stuff
enddo

I'm pretty sure you cannot use the fileset to exclude anything.
 
Dear Vince and Charles,

Yes, the special DO keyword ITERATE with a counter is the solution. I never thought about that. :smile:

Thank you very much.
 

Similar threads

Back
Top