利用perl读取目录下的文件列表

v1.0

#读取当前目录下的文件名列表
use strict;
opendir TMP, "./" || die "cannot open dir";
open RES, ">./file_list.txt" || die "Cannot open and write";
foreach (readdir TMP){
    if(/.+\.pdf/){
        print RES "$_\n";
    }
}

 

posted @ 2019-09-14 10:15  LeleLiu  阅读(1351)  评论(0编辑  收藏  举报