Visual Studio .NET - Filesystemwatcher change event

Asked By vishal
31-Aug-10 10:51 PM

Hi,

  Plzzzzzz help......
    I had created a windows service. When I copy a new file into specified folder FSW created event is working perfectly for me.
1) But when I write a FSW Changed event and trying to copy a new file, Created event as wellas changed event(3 times) fires.
In changed event i check with the condition If e.ChangeType = WatcherChangeTypes.Changed, but still it is executing inside that block of code. 
2) When I am copying a file in to a folder where there is already a file with same name exist. so it overwrites the existing file.
After overwriting the changed event fires multiple time.

pls help me anyone to get  a perfect solution. 

  samjayander thiagarajan replied to vishal
01-Sep-10 01:23 AM
Hi,

This is the behavior of the FileSystemWatcher. It reacts on each event and the event naturally corresponds to the application that creates the file.

For example, in WinZip, when you create a Zip file, it will first create a temporary file and then it will create the original file. so each application behaves differently while creating a file.

So, what is your requirement?? You should tailor your methods in subscribing and filtering the events based on your requirement.  

Coming up with your requirements may help to provide the best possible solution.

Regards,
Sam.
Create New Account
help
Visual Studio .net .NET Framework Hi NG, ich habe vor längerer Zeit mit Visual Studio .Net 2003 gearbeitet und überlege momentan auf einen neueren Stand upzudaten. Ein Visual Studio .Net 2008 scheint es nicht zu geben. Habe zumindest mit googeln nichts gefunden. Was
Wise for Visual Studio.NET Wise for Visual Studio.NET By Peter A. Bromberg, Ph.D. To "Print This Page" Link Peter Bromberg Wise for Visual Studio .NET is a total and complete installation development system for creating and editing Windows® Installer
Visual Studio versioning . . . . how to tell? .NET Framework To my knowledge, Visual studio 6 was released in 1998, then Visual Studio .NET 2002 is VS 7, then Visual Studio .NET 2003 is VS 7.1, then Visual
visual studio.net 2003 and Access 2007 database .NET Framework Hi I am currently using Visual Studio.Net 2003 running on Windows Server 2000 operating system. I have used Visual Studio.net 2003 connecting to Access 2002 databases in the pass with great success. Now
Is Visual Studio self-hosting ? .NET Framework Does Microsoft use Visual Studio IDE, Visual Studio Debugger, Visual Studio Linker and Visual Studio compiler for developing Visual Studio ? Or is Visual Studio not