+ -
当前位置:首页 → 问答吧 → perl 怎么使用Find过滤某些目录

perl 怎么使用Find过滤某些目录

时间:2011-02-07

来源:互联网

perl 可以使用File::Find 模块的find函数遍历目录,但是我想过滤掉某个目录不知道应该怎么做?
希望大虾帮忙 谢了

作者: zzy7186   发布时间: 2011-02-07

preprocess
The value should be a code reference. This code reference is used to preprocess the current directory. The name of the currently processed directory is in $File::Find::dir. Your preprocessing function is called after readdir(), but before the loop that calls the wanted() function. It is called with a list of strings (actually file/directory names) and is expected to return a list of strings. The code can be used to sort the file/directory names alphabetically, numerically, or to filter out directory entries based on their name alone. When follow or follow_fast are in effect, preprocess is a no-op.红色部分好像说可以过滤目录。不知道具体怎么做 望高手指教下。。。

作者: zzy7186   发布时间: 2011-02-07