Perl 查找::文件::规则排除子目录
我有以下代码:Perl 查找::文件::规则排除子目录,perl,Perl,我有以下代码: use strict; use warnings; use File::Find::Rule; my @text = File::Find::Rule->file() ->name('*.txt') ->in('c:\windows','c:\temp'); 并且只想找到c:\windows下的所有.txt文件,而不是c:\windows\子文件夹下的
use strict;
use warnings;
use File::Find::Rule;
my @text = File::Find::Rule->file()
->name('*.txt')
->in('c:\windows','c:\temp');
并且只想找到c:\windows下的所有.txt文件,而不是c:\windows\子文件夹下的所有.txt文件,如c:\windows\test1等。。是否可以使用
File::Find::Rule
执行类似操作您可以通过使用->maxdepth(1)
避免递归
IIRC,它需要位于其他过滤器之前。另请参见