搬运: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文件系统下的多种文件提供的系统 ...
随机推荐
- Java开发中经典的小实例-(输入三个数字判断三角形类型)
import java.util.Scanner;public class threeTest { public static void main(String[] args) { ...
- Mac 安装 MySQL
在 Mac 下用 Homebrew 安装 MySQL, 网上的教程倒是很多,不过大多数都很默契地雷同.如果稍有点定制要求,就无从下手了. 我先也不免俗,从基本的开始: 一.首先安装 Homebrew ...
- Node.js学习-1
关于node.js 首先,node.js不是一门语言,是一个平台.因为在以前,javascript主要是用于网页的交互,所以必须依附于浏览器存在,只有在浏览器上才能运行javascript. 后来ja ...
- Asp.Net完美隐藏服务器信息
首先在Global.asax.cs里增加: protected void Application_PreSendRequestContent(object sender, EventArgs e){H ...
- 蒙特卡洛马尔科夫链(MCMC)
蒙特卡洛马尔科夫链(MCMC) 标签: 机器学习重要性采样MCMC蒙特卡洛 2016-12-30 20:34 3299人阅读 评论(0) 收藏 举报 分类: 数据挖掘与机器学习(41) 版权声明: ...
- python成长之路【第八篇】:异常处理
一.异常基础 在编程过程中为了增加友好性,在程序出现bug时一般不会将错误信息显示给用户,而是现实一个提示的页面,通俗来说就是不让用户看见大黄页!!! 语法: try: pass except Exc ...
- LoadLibrary失败,GetLastError MOD_NOT_FOUND
即使传入的.dll文件存在,也可能返回这个错误.因为加载的DLL库可能以来其他库,尤其是编译器的dll. 以腾讯的debug版libtim.dll为例:如果没有msvcr100d.dll和msvcp1 ...
- JS原型的问题Object和Function到底是什么关系
var F = function(){}; Objcert.prototype.a = function(){}; Function.prototype.b = function(){}; F 既能访 ...
- SPSS数据分析—两阶段最小二乘法
传统线性模型的假设之一是因变量之间相互独立,并且如果自变量之间不独立,会产生共线性,对于模型的精度也是会有影响的.虽然完全独立的两个变量是不存在的,但是我们在分析中也可以使用一些手段尽量减小这些问题产 ...
- .net乱码问题
最近在给一个客户做framwwork版本升级,从1.0版本升级到4.0版本,发现最大的问题就是乱码. 在1.0版本下,gb2312编码能够运行得很好,可是升级到4.0后就都是乱码. 随后将webcon ...