NAnt SDK Documentation - v0.92 |

# DirectoryScanner Class

Used for searching filesystem based on given include/exclude rules.

For a list of all members of this type, see DirectoryScanner Members.

System.Object
NAnt.Core.DirectoryScanner

[Visual Basic]
<Serializable, _ Serializable>
Public Class DirectoryScanner
Implements ICloneable
[C#]
[Serializable]
[Serializable]
public class DirectoryScanner : ICloneable

#### Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

#### Example

Simple client code for testing the class.

             while (true) {
                 DirectoryScanner scanner = new DirectoryScanner();

                 Console.Write("Scan Basedirectory : ");
                 string s = Console.ReadLine();
                 if (s.Length == 0) break;
                 scanner.BaseDirectory = s;

                 while(true) {
                     Console.Write("Include pattern : ");
                     s = Console.ReadLine();
                     if (s.Length == 0) break;
                     scanner.Includes.Add(s);
                 }

                 while(true) {
                     Console.Write("Exclude pattern : ");
                     s = Console.ReadLine();
                     if (s.Length == 0) break;
                     scanner.Excludes.Add(s);
                 }

                 foreach (string name in scanner.FileNames)
                     Console.WriteLine("file:" + name);
                 foreach (string name in scanner.DirectoryNames)
                     Console.WriteLine("dir :" + name);

                 Console.WriteLine("");
             }

#### Requirements

Namespace: NAnt.Core

Assembly: NAnt.Core (in NAnt.Core.dll)

#### See Also

DirectoryScanner Members | NAnt.Core Namespace