gpt4 book ai didi

linux - Ubuntu iNotify 多文件夹

转载 作者:太空宇宙 更新时间:2023-11-04 09:45:26 25 4
gpt4 key购买 nike

我编写了一个简短的 bash 脚本来为多个文件夹设置 iNotify,然后调用 Python 脚本将文本从创建的文件上传到网络服务。该过程适用于列表中的第一个文件夹,但创建事件似乎并未触发其他文件夹。我假设我已经正确地构建了我的脚本。有任何想法吗?代码基本上是:

#!/bin/bash
inotifywait -m --format '%w%f' -e create /Folder1 | while read FILE
do
echo $FILE
# upload file
python /Scripts/UploadFileContents.py 'PAUR' $FILE
done
inotifywait -m --format '%w%f' -e create /Folder2 | while read FILE
do
echo $FILE
# upload file
python /Scripts/UploadFileContents.py 'RACH' $FILE
done
inotifywait -m --format '%w%f' -e create /Folder3 | while read FILE
do
echo $FILE
# upload file
python /Scripts/UploadFileContents.py 'CDR' $FILE
done
inotifywait -m --format '%w%f' -e create /Folder4 | while read FILE
do
echo $FILE
# upload file
python /Scripts/UploadFileContents.py 'CHR' $FILE
done
inotifywait -m --format '%w%f' -e create /Folder5 | while read FILE
do
echo $FILE
# upload file
python /Scripts/UploadFileContents.py 'PRMS' $FILE
done

在此先感谢您的帮助。

最佳答案

您必须在后台启动 inotifywait 脚本,因为它们会阻塞直到出现更改

关于linux - Ubuntu iNotify 多文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16735853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com