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 directory, 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?

链接地址: http://www.djcxy.com/p/25364.html

上一篇: 在fsevents中更改pathsToWatch

下一篇: 使用NSFileManager获取复制文件的修改日期