看一个文件夹 [英] Watching a folder
本文介绍了看一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以给我一些帮助,PLZ
我想创建一个perl脚本来观看文件夹。
每次有新文件到达那里它会触发一些代码;
我该怎么做?
TIA,
Jo ??Correia
Can anyone give me some help, plz
I want to create a perl script to be watching a folder.
Everytime a new file gets there it triggers some code;
How can I do this?
TIA,
Jo?o Correia
推荐答案
据我所知,已经有一个模块用于观看文件夹。但是您可以打开文件夹并将文件列表读入另一个文件(files.txt)。每隔一段时间就会有一个perl脚本打开文件夹,并根据files.txt中的文件列表检查文件列表。如果有一个新文件运行你的代码。
For all I know there is a module already written for watching a folder. But you could open the folder and read the list of files into another file (files.txt). Every so often have a perl script open the folder and check the list of files against the list of files in files.txt. If there is a new file run your code.
我找到了这个模块,
File :: Monitor;
从我的读入CPAN我制作了这个脚本:
I found this Module,
File::Monitor;
From what I read in CPAN I made this script:
展开 | 选择 | Wrap | 行号
我找到了这个模块,
File :: Monitor;
从我在CPAN中读到的内容我制作了这个脚本:
I found this Module,
File::Monitor;
From what I read in CPAN I made this script:
展开 | 选择 | Wrap | 行号
这篇关于看一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文