Perl:搜索其中包含特定字符串的所有目录

时间:2018-05-28 14:56:07

标签: regex perl

我想搜索一个文件夹来查找文件,让我说我正在搜索/ Applications /寻找target.exe:

我现在遇到的问题是搜索/ Applications /(约70秒)内的所有内容需要很长时间

我希望将搜索范围缩小到:/ Applications / Example-Version,但每个示例目录的版本都不同

如何使用File :: Find仅搜索具有路径/ Applications / Example-X的目录?

1 个答案:

答案 0 :(得分:0)

使用文件Globbing:

#!/usr/bin/perl -w
@files = </Applications/Example-Version*/target.exe>;
foreach $file (@files) {
  print $file . "\n";
} 
相关问题