0

I have a line of code that looks like this, which loads all immediate directory names into Variable A, then continues on through the rest of the loop.

for /d %%A in (*) do

How can I change this such that it skips over items in a pre-defined IgnoreList? For instance:

IgnoreList: Item 1, Item 2, Item 3...note that some Items will have spaces.

Josh
  • 3

2 Answers2

0
dir /b /ad c:\ |findstr /virxg:exclude.txt

where exclude.txt contains folders to ignore, one per line (wildcards possible with findstr REGEX):

Windows
Users
Program.*
Documents.*

If you want to do something with the results, your for loop could look like:

for /f "delims=" %%a in ('dir /b /ad c:\ ^|findstr /virxg:exclude.txt') do @echo %%a
Stephan
  • 1,678