V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
shimingzhoudf
V2EX  ›  Python

pyhon 响应

  •  
  •   shimingzhoudf · 2019-07-03 19:31:19 +08:00 · 1682 次点击
    这是一个创建于 1752 天前的主题,其中的信息可能已经有所发展或是发生改变。

    启动 python 打包好的 exe,如果文件夹添加或修改文件夹里面的内容,自动执行某些逻辑能做到吗

    3 条回复    2019-07-03 21:19:27 +08:00
    russian
        1
    russian  
       2019-07-03 21:12:07 +08:00
    求你把逻辑说的更清楚一点。
    niubee1
        2
    niubee1  
       2019-07-03 21:18:05 +08:00
    Windows 提供了几种方式对文件和目录进行监控,包括:FindFirstChangeNotification、ReadDirectoryChangesW、变更日志(Change Journal)等。


    ( 1 ) FindFirstChangeNotification 函数,可以监控到目标目录及其子目录中所有文件的变化,但不能监控到具体是哪一个文件发生改变。

    ( 2 ) ReadDirectoryChangesW 能监控到目标目录下某一文件发生改变,并且可以知道发生变化的是哪一个文件。

    注意,FindFirstChangeNotification 和 ReadDirectoryChangesW 是互斥的,不能同时使用。
    ( 3 )变更日志(Change Journal)可以跟踪每一个变更的细节,即使你的软件没有运行。很帅的技术,但也相当难用。
    ---------------------
    作者:pjl1119
    来源:CSDN
    原文: https://blog.csdn.net/pjl1119/article/details/51275355
    版权声明:本文为博主原创文章,转载请附上博文链接!


    随便搜索一下 windows 监听文件夹变更就能得到结果。Python 本身是没法做的, 调用 windows api 实现就行了
    loading
        3
    loading  
       2019-07-03 21:19:27 +08:00 via Android
    如果我没理解错:
    github.com/gorakhargosh/watchdog
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2292 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:48 · PVG 08:48 · LAX 17:48 · JFK 20:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.