Use perl to read a list of files in a directory

v1.0

# Read the current directory list of file names 
use strict;
 opendir TMP, " ./ " || Die  " CAN not Open dir " ;
 Open RES, " > ./ file_list.txt " || Die  " of Can not Open and the Write " ;
 the foreach ( the readdir the TMP) {
     IF (/.+\.pdf/ ) {
         Print the RES " $ _ \ n- " ; 
    } 
}

 

Guess you like

Origin www.cnblogs.com/liulele/p/11518470.html
Recommended