簡體   English   中英

Find::File::Rule 排除子目錄

[英]Find::File::Rule exclude sub directories

我有以下代碼:

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

您可以通過使用->maxdepth(1)來避免遞歸。

IIRC,它需要排在您的其他過濾器之前。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM