using wildcard in the dir locations and find all files with an extension

前端 未结 2 1938
庸人自扰
庸人自扰 2021-01-25 02:52
my @hex_locations = (\"$FindBin::Bin/../../../project/platform-fsm9900_cdp-full/build-target/gnss-1.0.0\",
                     \"$FindBin::Bin/../../../project/platform         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-25 03:39

    To answer the actual question.

    my @hex_dep_files;
    for my $loc (@hex_locations) {
       find({
          no_chdir => 1,
          wanted => sub {
             my $F = $File::Find::name;
             return if $F !~ /.d$/;
             push @hex_dep_files, $F;
          },
       }, $loc);
    }
    

    or

    my @hex_dep_files;
    find({
       no_chdir => 1,
       wanted => sub {
          my $F = $File::Find::name;
          return if $F !~ /.d$/;
          push @hex_dep_files, $F;
       },
    }, @hex_locations);
    

提交回复
热议问题