我如何检测任何文件或文件夹是否被复制/移动到目录,然后运行 shell 脚本?
复制/移动的文件大多数与现有文件具有相同的文件名......
答案1
您可能应该使用包inotify
中提供的命令行工具。inotify-tools
包装也应该更好inoticoming
。描述:
Description: trigger actions when files hit an incoming directory
inoticoming is a daemon to watch a directory with Linux's inotify
framework and trigger actions once files with specific names are placed
in there.
.
For example it can be used to wait for .changes files uploaded
into a directory and call reprepro to put them into your repository.