开发者

Using NSFileManager to get the modified date of a copied file

I'm using NSFileManager's attributesOfItemAtPath to calculate the date a file was last modified in OS X. While this works, in many cases the file modification date doesn't behave as I would have expected it to. For example: if I copy a file created in 2009 and paste it into a new directory it retains the created and modified date of the original file.

To put the issue in context, I'm monitoring filesystem events using the FSEvents API. This alerts me that a change has occurred at the directory level. To detect which file has changed within that particular d开发者_StackOverflowirectory, I iterate through each file and check its modification date. This works fine for newly created files, but not for files which have been copied from elsewhere on the filesystem.

Is there a low-level API that I can access for more information on a particular file? If not, what's the best way to determine specific filesystem changes on the file level?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜