Monitor folders or Files changes in OSX

I need a way in OSX to monitor folders and/or files for changes. When a folder content is changed (added, removed file, update file) or another folder has been added renamed or deleted.
There is way to do this thing in OSX ? There is A KINd of system service can be useful accesing to It by declares or some xojo plugin ?


File System Events
I’m sure MBS has a plugin for this and I’m pretty sure you can lift the relevant portions out of MacOSLib to do it without a plugin

Thank you Norman for the hint. Fsevent is documented and used in MacOsLib demo project ?

Yes, I use MacFSEvents in MacOSLib and it works very well. Be aware, however, that MacOSLib is 32-bit and almost certainly never will be 64-bit compatible. That may or may not be important to you.

A whole sale conversion of MacOSLib to support 64 bit is unlikely
Moving one portion to support 64 is plausible

I’d like to think so. There are so many dependencies, though, that it looks very difficult. I’m secretly hoping that the forthcoming Interops feature coming to Xojo will make this more feasible.

How about FileSystemWatcher by Einhugur?


a complete implementation and thread safe.

This plugin can be very usefull for me. Thanks Sacha. I will take a look
It also crossplatform.
Also the MBS implementation of fseventsmbs is very interesting and I will compare with the Einghur…but I already have an MBS license …so…

I heard on a podcast that Dropbox uses FSEvents to know when files are changed…

Yes, they do.

MBS FSEvent implementation detect folder changes recursively ? It is possible to define more than one folder/file at time ?

Yes & Yes.
Maybe you test it.

Sorry Christian. There is any sample on your class for FSEvent ? Also your implementation is 64bit safe ?

Well, five FSEvents examples are included with MBS Plugins.
Did you use them?

And yes, it should work well with 64-bit.

Now a question raise to me and It is very important. Do an application monitoring system through FSEvent can be accepted on the MAS ? This is mission critical to me. Chiristian, Can u have any experinece on It ?

The MBS FSEVent class works in 64bit and can be used for MAS apps.
I use it quite extensively in one of my apps.

But be prepared to do a lot of work. FSEvent just gives you a notice ‘something’ changed. You will have to figure out what changed, keep a database, verify things yourself, …
To make it work right, you will need a lot of code and thoughtful planning how to implement it.

This should work for MAS.
You may need to deal with permissions.
Like let the user select the folder and keep a secure bookmark to it.

I remember a discussion a while ago with Eduardo Gutierrez de Oliveira about a very similar topic :

It may be of use.