FSEvents 和复制大文件
我正在使用 FSEvents 监视文件目录,该目录将复制一些大文件。目前,当我开始复制文件时,FSEvents 似乎会发出通知,并在完成文件复制时再次发出通知。但当文件较小时,我只收到一个事件。有什么方法可以检查文件是否正在复制中?
顺便说一句,这是针对雪豹的。
I'm using FSEvents to monitor a directory of files that will have some large files copied into it. Currently FSEvents seems to be sending out a notification when I've begun copying the file, and again when it's finished copying the file. When it's a smaller file though, I only get the one event. Is there any way to check if a file is in the middle of being copied?
This is for Snow Leopard by the way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终只是使用 lsof 来检查文件是否在内核级别打开。我只有在 lsof 确定该文件不再使用后才开始处理该文件。
I ended up just using lsof to check if the file is open at a kernel level. I only begin processing the file once lsof has determined that the file is no longer in use.