python - 使用shell脚本或python检查目录内容是否发生变化

标签 python shell latex

我有一个在特定目录中创建文件的程序。 当这些文件准备就绪后,我运行 Latex 来生成一个 .pdf 文件。 所以,我的问题是,如何使用此目录更改作为触发器 调用 Latex,使用 shell 脚本还是 python 脚本?

最好的问候

最佳答案

inotify 替换 dnotify

Why?

...dnotify requires opening one file descriptor for each directory that you intend to watch for changes...

Additionally, the file descriptor pins the directory, disallowing the backing device to be unmounted, which causes problems in scenarios involving removable media. When using inotify, if you are watching a file on a file system that is unmounted, the watch is automatically removed and you receive an unmount event.

...等等。

More Why?

Unlike its ancestor dnotify, inotify doesn't complicate your work by various limitations. For example, if you watch files on a removable media these file aren't locked. In comparison with it, dnotify requires the files themselves to be open and thus really "locks" them (hampers unmounting the media).

Reference

关于python - 使用shell脚本或python检查目录内容是否发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4862346/

相关文章:

latex - 我如何将 LaTeX 警告视为错误

Python 并删除列表列表中的重复项,而不管列表中的顺序如何

php - Certbot-auto - 通过 shell 脚本运行?

linux tar 命令 -t 选项显示 max-depth=1

bash - 找不到 sed 命令

latex 转义字符

python - 在 Python 中使用 pstats 和 cProfile。如何使数组工作得更快?

python - 根据列表属性的第二个值对对象列表进行排序

linux - 关于 linux shell 脚本几乎不需要帮助

latex - 将页面分成 block /部分