开发者

FSEvents and copying large files

开发者 https://www.devze.com 2023-02-05 12:12 出处:网络
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 th

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消