Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2007

Tip: Looking for answers? Try searching our database.

FileSystemWatcher and multiple changed events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
D2 - 11 May 2007 15:07 GMT
Hi,

I have this problem when working with FileSystemWatcher class. I m
using one of these objects to watch over a folder. Whenever i big file
from another folder to the folder being watched, I get created event
and multiple changed events.
After the file is copied (fully) i want to read the file and perform
some operations on it. Now the issue is, there is no way to find that
the file has been copied entirely.

there are some workarounds like try to open file in a loop until u r
successful (this is the time when file got copied). This has a
potential problem, if I copy large number of files, it will skip about
50% of them .. depending on the size of files being copied.

Any better solutions?

Thanks,
D2
Nicholas Paldino [.NET/C# MVP] - 11 May 2007 15:15 GMT
D2,

   Is the file being copied part of a controlled environment?  In other
words, is the file being copied as the result of an operation from a client
which you have control over, or is it meant as a general file monitoring
system?

   There was a system where I needed to process files once they were
dropped in a directory.  I wanted to use the file system watcher, but I
couldn't know for sure when the writing of the file was complete.  Because
we were in control of the client, we made it so that the client wrote a zero
byte marker file which would tell the FileSystemWatcher when to process the
original file.  Since the marker file was zero bytes, one could reasonably
assume that the marker file and original file were both closed by the end of
processing.

   Perhaps you could do something similar?

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi,
>
[quoted text clipped - 15 lines]
> Thanks,
> D2

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.