Getting to modify events on changes in file?

I am using Watch Service API of nio.2 classes to watch a specific directory( Ubuntu 11.10). whenever a change is made, for eg if I modify in existing file, it fires a MODIFIED event 2 times. Don't know why? it's work fine when I create new file.

Answers


I found a solution for it. It fires two modify events, because when the filesystem writes new files, it creates it with zero byte and fires create event and then it writes data to the and file then it fires the modify event.

The same applies with modifications. When we modify an already existing file, the filesystem first creates it with 0 bytes and fires a modify event and then writes data to it. Then it fires the modify event again. That's why I was receiving two modify events.


Need Your Help

CMFCOutlookBarPane icons disappearing when dragging

visual-c++ outlook icons imagelist

In Visual C++, I have a CMFCOutlookBarTabCtrl that has been created with:

store a blob string in database table

c# wpf azure-storage-blobs

Hi I'm new to azure storage blob. I have a project in WPF and I have created a container in azure storage blob that I can send /upload images to on button click. Can anyone tell me if I can store a

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.