Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notifications for file system changed?

I'm implementing a free space on disk bar where while files are being copied, the free space bar updates. I need some way of being notified of file system changes. What's the best way to go about doing this?

like image 907
indragie Avatar asked Sep 30 '09 23:09

indragie


2 Answers

The File System Events Programming Guide has all the info you need. You want to register with the File System Events API (OS X 10.5 and later).

like image 100
Barry Wark Avatar answered Oct 15 '22 00:10

Barry Wark


To monitor operations on individual files you can use kqueue file change notifications. Uli Kusterer has a nice Obj-C wrapper called UKKQueue.

You can get it here: http://zathras.de/angelweb/sourcecode.htm

If you want to watch an entire folder, FSEvents (and the SCEvents wrapper) will probably be of more use.

like image 23
Nick Forge Avatar answered Oct 14 '22 23:10

Nick Forge