搬运:Python for Windows——监控Windows某个目录下文件的变化
https://win32com.goermezer.de/content/view/286/285/
这个网站真是给力,不多说,代码直接搬运过来,还有我的测试结果,拿走不谢!
import os
import sys import win32file
import win32con ACTIONS = {
1: "Created",
2: "Deleted",
3: "Updated",
4: "Renamed from something",
5: "Renamed to something"
} FILE_LIST_DIRECTORY = 0x0001 path_to_watch = 'E:/test'
print 'Watching changes in', path_to_watch
hDir = win32file.CreateFile(
path_to_watch,
FILE_LIST_DIRECTORY,
win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
None,
win32con.OPEN_EXISTING,
win32con.FILE_FLAG_BACKUP_SEMANTICS,
None
)
while 1: results = win32file.ReadDirectoryChangesW(
hDir,
1024,
True,
win32con.FILE_NOTIFY_CHANGE_FILE_NAME |
win32con.FILE_NOTIFY_CHANGE_DIR_NAME |
win32con.FILE_NOTIFY_CHANGE_ATTRIBUTES |
win32con.FILE_NOTIFY_CHANGE_SIZE |
win32con.FILE_NOTIFY_CHANGE_LAST_WRITE |
win32con.FILE_NOTIFY_CHANGE_SECURITY,
None,
None)
for action, filename in results:
full_filename = os.path.join(path_to_watch, filename)
print full_filename, ACTIONS.get(action, "Unknown")
运行结果:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVgAAAEJCAIAAABe3KhFAAAdaklEQVR4nO2d/1PbxrrG77+S2865nS4YGEMOOZOTQyEdHGLjxEDc23hCSFugCZQJN+kp00BCCSU0lBBa2kCIU4zr77EtfwPu/nP3h2111d2VtBhjBH4+s5ORV+/uvlpJj2QhP/kPAgBoeP7jpBMAAJw8EAIAAIQAAAAhAAAQCMEpwuv1bm9vn3QW4GwiFwJK6bVr12KxGFuuundKqbT5+vp61X0edqx6ctjtogaWl5etg589e3b//v0jZAeAKXIhWF9fD4VC29vbKysrP/zwg1ljt9ttfe7ZBtSQeo5VK1jOzc3NLS0tDx8+tIhsb2/XNK2zs9PYsLrhqswVnGnkQvDdd99NTEwUi8VSqTQ7O2vWOBgM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KrE6a8Yw6oMOJyxsbFUKrW3t5dIJCxsph2O04UAAFAHIAQAAAgBAABCAAAgEAIAAIEQAAAIhAAAQCAEAAACqzIAAGk0q7Le3t7Xr1+Xy+VYLKb/Z+HHBMvHafZhzsEs1QaxBnMajWVVtra21tXV1dbWNjU1ZeHkc1btw07WjQvWYE6msazKNjc32YLb7c5kMofKp4oYFuAc+7Dq9k6tgDWYk2lQq7LR0VGL23Xxx6dnzD5Mr+FMvqTAGqwRaESrsqGhoc8//9xiu7h8zqp9GBFMvqTAGqwRaDirsvHxcePTBzO4fM6qfRhn8iUF1mCNQGNZlU1NTd29e5cQ0tTUNDU1ZTEvZ9I+TMyZM/mSAmuwRqCxrMoODg70sDdv3ogbJc2HxZ8B+zDp3jGafEmBNVgjAKsycMo4G9ZgTsPprxg7waoMOIqzYQ3mNJwuBACAOgAhAABACAAAEAIAAIEQAAAIhAAAQCAEAAACIQAAEFiVAQAIrMqOD/GdecXgWg0KgDqwKquyK0WrMrZMLX8RSGpnMWbdDwBmwKpMNZ8qYoxCYB1pHXOoWYUQgCqAVZn9ttMjWJUZF1j80tKSpmn6r2VEizHpdtnOqopVGQBmwKrMdPP15aNYlRkX2B3+0NBQIBBIJpNslWgxJs3ZdlYVrcoAkAKrMjlcPkexKmtqauISc7lclUqF1YgWY2LO4lhVW5UBIAVWZXKOblVGCCkWi16vNxQK6XcolFKPxxMKhXZ3d1mNaDHG5aw4q4pWZQBIgVXZcVmVEULu3r2by+Wy2ax+AlNKX716lcvl9D9eihZjXM6Ks6poVQaAFFiV1Y+2tjZcroEzcforxmfJqkx8+A+AQ3C6EAAA6gCEAAAAIQAAQAgAAARCAAAgEAIAAIEQAAAIhAAAQCAEAAACIQAAEAgBAIBACAAABEIAACAQAgAAgRAAAAiEAABAIAQAAAIhAAAQCAEAgEAIAAAEQgAAIIT8H3yf78BtiiELAAAAAElFTkSuQmCC" alt="" />
到这一步,后面可以做得就多了,可以写LOG,做统计,做预警,太爽啦!
搬运:Python for Windows——监控Windows某个目录下文件的变化的更多相关文章
- python 实现统计ftp服务器指定目录下文件夹数目、文件数目及所有文件大小
本次主要为满足应用方核对上传到ftp服务器的文件是否缺漏. 主要要求:指定目录下,文件夹数目/文件数目/所有文件大小,类似Windows如下功能: 模块介绍: from ftplib import F ...
- C# 利用FTP自动下载xml文件后利用 FileSystemWatcher 监控目录下文件变化并自动更新数据库
using FtpLib; using System; using System.Collections.Generic; using System.ComponentModel; using Sys ...
- shell脚本监控目录下文件被篡改时报警
思路: 目录下文件被篡改的几种可能: 1.被修改 2.被删除 3.新增文件 md5命令详解 参数: -b 以二进制模式读入文件内容 -t 以文本模式读入文件内容 -c 根据已生成的md5值,对现存文件 ...
- python生成器 获取 目录下文件
# os.walk()和os.list 都是得到所有文件的列表, 如果目录下文件特别多, 上亿了, 我们就需要生成器的方式获取 # 要求目录下面没有目录, 会递归到子目录下面找文件, (如果有子目录可 ...
- Linux常用基础命令整理:关机命令、查看目录下文件命令等
Linux常用基础命令整理:关机命令.查看目录下文件命令等 整理了一些Linux常用基础命令,欢迎指正. 首先记住四个热键,学会这四个键,收益一辈子. Tab按键---命令补齐功能Ctrl+c按键-- ...
- linux 系统统计目录下文件夹的大小
du -ah --max-depth=1 这个是我想要的结果 a表示显示目录下所有的文件和文件夹(不含子目录),h表示以人类能看懂的方式,max-depth表示目录的深度. du命令用来查看 ...
- C# 获取目录下文件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- linux 目录下文件批量植入和删除,按日期打包
linux目录下文件批量植入 [root@greymouster http2]# find /usr/local/http2/htdocs/ -type f|xargs sed -i " ...
- Linux中/proc目录下文件详解
转载于:http://blog.chinaunix.net/uid-10449864-id-2956854.html Linux中/proc目录下文件详解(一)/proc文件系统下的多种文件提供的系统 ...
随机推荐
- VS工具--GhostDoc
一.介绍: GhostDoc是Visual Studio的一个免费插件,可以帮助开发人员编写XML格式的注释文档. C#中XML格式的文档注释好处多多:Visual Studio会在很多地 ...
- WinForm开发框架【细化权限至操作按钮】
有不少园友经常问我程序有没有更新,真的很抱歉,最近因为工作原因一直很忙,导致程序有很长时间都没有更新了,首先在这里感谢关心俺的朋友们. 这几天好好看了一下原来的程序,还有很多地方需要改进,比如操作数据 ...
- [Android] Google IAP unmaneged items服务器校验
android IAP unmaneged items 服务器校验 当成功IAP以后, 会在google服务器记录此次购买的状态. 可以通过Google Play Android Developer ...
- win7 32位安装php redis驱动
根据php版本下载php_redis扩展,然后把php_redis.dll这个扩展文件放到php中的ext文件夹中,然后再去php-ini中添加一行代码:extension=php_redis.dll ...
- (十二)select()函数以及FD_ZERO、FD_SET、FD_CLR、FD_ISSET
select函数用于在非阻塞中,当一个套接字或一组套接字有信号时通知你,系统提供select函数来实现多路复用输入/输出模型,原型:int select(int maxfd,fd_set *rdset ...
- position之fixed固定定位、absolute绝对定位和relative相对定位
什么是层模型? 什么是层布局模型?层布局模型就像是图像软件PhotoShop中非常流行的图层编辑功能一样,每个图层能够精确定位操作,但在网页设计领域,由于网页大小的活动性,层布局没能受到热捧.但是在网 ...
- windbg运行
运行起来会提示windbg is running. BUSY 这个是正常运行的状态,只有发生异常,或者被指定断点,才会中断.
- java:同步和死锁
多个线程共享一个资源的时候需要进行同步(否则会出现错误:如负数,重复数),但是过多的同步会造成死锁. synchronized(this) { } 非同步情况: public class SyncTh ...
- SQL Server Replication issues-the row was not found at the subscriber end
Issue type: 1.find out the number 0x0006F18F00006082002300000000 from publication end. 2.use below s ...
- Ajax些成绩批量录入
1.jsp,ajax的循环调用,必须要递归,否则会出错. <%@ page language="java" import="java.util.*" pa ...