[英]Find::File::Rule exclude sub directories
I have the following code:我有以下代码:
use strict;
use warnings;
use File::Find::Rule;
my @text = File::Find::Rule->file()
->name('*.txt')
->in('c:\windows','c:\temp');
and want only to find all the.txt files under c:\windows and not under c:\windows\ subfoldes like c:\windows\test1 etc.. is it possible to do something like this with File::Find::Rule
and want only to find all the.txt files under c:\windows and not under c:\windows\ subfoldes like c:\windows\test1 etc.. is it possible to do something like this with
File::Find::Rule
You can avoid recursing through the use of ->maxdepth(1)
.您可以通过使用
->maxdepth(1)
来避免递归。
IIRC, it needs to come before your other filters. IIRC,它需要排在您的其他过滤器之前。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.