0

I need to monitor the available free space on the disk using objective-c, especially when it changes. If this is not feasible then I am interested to detect when the trash is emptied by the user.

Thanks for your help,

Regards,

Christofer Eliasson
  • 32,939
  • 7
  • 74
  • 103
AP.
  • 5,205
  • 7
  • 50
  • 94
  • See the duplicate question [here][1]. [1]: http://stackoverflow.com/questions/1626139/how-do-you-find-how-much-disk-space-is-left-in-cocoa – jeffslofish Dec 19 '11 at 07:12
  • Not a duplicate. Question is not about knowing free space but being notified when it changes – AP. Dec 19 '11 at 08:44

1 Answers1

0

There are about a zillion things at any given moment that might be writing to disk; VM, console logs, programs, caches, preferences, the user, etc...

... thus, receiving a notice of whenever free disk changes is pretty much useless because you would be receiving such a notice all the time.

Watching for the trash being emptied shouldn't be too hard; a kqueue could do it easily enough. But that isn't likely to tell you much, either; the trash might have 400MB in it or it might have 4K.

What are you really trying to do?

bbum
  • 162,346
  • 23
  • 271
  • 359
  • Thanks for your ideas. I am "just" trying to have something like in the bottom bar of the Finder, showing current free space. I am not interested by something super accurate, but just giving an idea. – AP. Dec 19 '11 at 07:12
  • Have a look at kqueues or dispatch sources, then. You might have to resort to periodic polling, but that is to be avoided. – bbum Dec 19 '11 at 14:56