0

在 OS X 上,有一个 API 可以为磁盘上的给定文件创建一个“书签”,即使它被移动或重命名,它也会跟踪它的目标。然后,OS X 应用程序可以序列化书签,以它想要的任何方式存储它,并在以后的某个日期(可能在退出并重新启动之后)反序列化书签并从中解析文件路径。

Linux 有什么可比的吗?

4

1 回答 1

0

http://en.wikipedia.org/wiki/Inotify

我猜这 inotify 是你想要的。使用 inotify,您可以监视文件的以下事件:

IN_ACCESS - read of the file
IN_MODIFY - last modification
IN_ATTRIB - attributes of file change
IN_OPEN - open of file
IN_CLOSE_WRITE - sent when a file opened for writing is closed
IN_CLOSE_NOWRITE - sent when a file opened not for writing is closed
IN_MOVED_FROM and IN_MOVED_TO - when the file is moved or renamed
IN_DELETE - a file/directory deleted
IN_CREATE - a file in a watched directory is created
IN_DELETE_SELF - file monitored is deleted
于 2012-11-29T22:46:38.310 回答