检测磁盘上的可用空间何时发生变化

发布于 12-21 21:04 字数 100 浏览 3 评论 0原文

我需要使用 Objective-C 监视磁盘上的可用空间,尤其是当它发生变化时。 如果这不可行,那么我有兴趣检测用户何时清空垃圾。

感谢您的帮助,

问候,

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,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最近可好2024-12-28 21:04:33

在任何给定时刻,大约有无数的东西可能会写入磁盘;虚拟机、控制台日志、程序、缓存、首选项、用户等等……

因此,每当空闲磁盘发生变化时收到通知几乎没有用,因为您将一直收到这样的通知。

看着垃圾被清空应该不会太难; kqueue 可以很容易地做到这一点。但这也不可能告诉你太多信息;垃圾箱中可能有 400MB,也可能有 4K。

你到底想做什么?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文