code is as simple as can be...

in main ....

{
...
FileSystemWatcher fsw = new FileSystemWatcher("g:\\__files","*.asa");
fsw.EnableRaisingEvents = true;
fsw.IncludeSubdirectories = true;
fsw.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Attributes |
NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.Security | NotifyFilters.Size;
fsw.Changed += new FileSystemEventHandler(fsw_Changed);
fsw.InternalBufferSize = 65536;
...
}

then i defined:

        static void fsw_Changed(object sender, FileSystemEventArgs e)
        {
            string directory = Path.GetDirectoryName(e.Name);
            string filename = Path.GetFileName(e.Name);

            Console.WriteLine(filename);

            if (e.ChangeType == WatcherChangeTypes.Deleted)
            {
            }
            if (e.ChangeType == WatcherChangeTypes.Renamed)
            {
            }

        }


only first access to file launches fsw_Changed.

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to