簡體   English   中英

在Linux上通過身份跟蹤文件

[英]Tracking a file by identity on Linux

在OS X上,有一個API為磁盤上的給定文件創建一個“書簽”,即使移動或重命名該文件,它也會跟蹤其目標。 然后,OS X應用程序可以序列化書簽,以所需的任何方式存儲它,並在以后的某個日期(可能是在退出並重新啟動后)對書簽進行反序列化並從中解析文件路徑。

Linux是否有可比的東西?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM