pyinotify使用总结,一款能够监控你文件夹打开,修改,删除,重命名的开源工具...

自己调研了很多软件,只有这一个能够实现监控文件打开的状态,很强大,提供的example也很详细

 

github主页:https://github.com/seb-m/pyinotify/wiki/Events-types

 

可以监控到这些状态

  • IN_ACCESS: a file was accessed
  • IN_ATTRIB: a metadata changed
  • IN_CLOSE_NOWRITE: an unwritable file was closed
  • IN_CLOSE_WRITE: a writable file was closed
  • IN_CREATE: a file/directory was created in watched directory
  • IN_DELETE: a file/directory was deleted in watched directory
  • IN_DELETE_SELF: a watched item itself was deleted
  • IN_DONT_FOLLOW: don't follow a symlink (since kernel 2.6.15)
  • IN_IGNORED: raised when a watch is removed. Probably useless for you, prefer using instead relying on IN_DELETE*
  • IN_ISDIR: always associated with an event triggered on a directory. The Event structure automatically provides this information via attribute event.dir
  • IN_MASK_ADD: to update a mask without overwriting the previous value (since kernel 2.6.14). Useful when updating a watch
  • IN_MODIFY: a file was modified
  • IN_MOVE_SELF: a watched item was moved, currently its full pathname destination can only be known if its source and destination directories were both watched. Otherwise, the file is still being watched but you cannot rely anymore on the given path attribute event.path
  • IN_MOVED_FROM: a file/directory in a watched directory was moved from another specified watched directory. Can trace the full move of an item when IN_MOVED_TO is available too, in this case if the moved item is itself watched, its path will be updated (see IN_MOVE_SELF)
  • IN_MOVED_TO: a file/directory was moved to another specified watched directory (see IN_MOVE_FROM)
  • IN_ONLYDIR: only watch the path if it is a directory (since kernel 2.6.15). Usable when calling watch_manager.add_watch()
  • IN_OPEN: a file was opened.
  • IN_Q_OVERFLOW: the event queue overflown. This event is not associated with any watch descriptor
  • IN_UNMOUNT: when backing fs was unmounted. Notified to each watch of this fs 


  •  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值