NAME
IncludeExcludeListFilter — Return list with all to be included, none to be excluded.
SYNOPSIS
IncludeExcludeListFilter ListVariable IncludePatternList ExcludePatternList
DESCRIPTION
Return Value
List where each element matches a pattern in the include pattern list, but not any pattern in the exclude pattern list.
Arguments
ListVariableCan be either a value or @VarName (will upvar and read/write).
IncludePatternListA list where each element can be used as an argument to string match. Only those elements of the input list which match at least one of the patterns may be included in the return list.
ExcludePatternListA list where each element can be used as an argument to string match. Anything that matches will definitely not be included in the returned list.
More Info
This command does the following for each element of the target list: (1) It checks to see if it matches any of the elements of the inclusion list, and if not, then it skips to the next. (2) It checks to see if it matches any of the elements of the exclusion list, and if so, then it skips to the next. (3) It adds the element to the return list.

So, what you end up with is a list where every element matches some pattern in the include list and none of the patterns in the exclude list. This may be useful for processing the files in a directory, for instance.

Note that arguments of the form XxxVariable can take either a normal value or the name of a variable to read/write, prefixed by @. See About Using @ for details.


For information regarding exceptions / errors, see here.
EXAMPLES
% set MyList {zero. dat one.txt two.txt special.txt}
% # Want elements that are text files, but not special.txt.
% IncludeExcludeListFilter $MyList {*.txt} {special.txt}
one.txt two.txt