string[] drives = Environment.GetLogicalDrives(); foreach (string strDrive in drives) { DriveInfo df = new DriveInfo(strDrive); FileWat = new FileSystemWatcher(); FileWat.IncludeSubdirectories = true; FileWat.Filter = "*"; FileWat.Path = df.Name; FileWat.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.Attributes | NotifyFilters.Size | NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.CreationTime | NotifyFilters.Security; FileWat.Created += new FileSystemEventHandler(FilewatCreated); FileWat.Changed += new FileSystemEventHandler(FileChanged); FileWat.Renamed += new RenamedEventHandler(FileRenamed); FileWat.InternalBufferSize = 65536; // 64 KB – the maximum allowed buffer size. FileWat.EnableRaisingEvents = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)