#!/usr/bin/perl -w
use strict;
use warnings;
my $dir = "/Users/username/documents folder";
opendir(DIR, $dir) or die $!;
while (my $file = readdir(DIR)) {
next if ($file =~ m/^\./); # ignore filenames starting with a dot.
print "$file\n";
}
closedir(DIR);
exit 0;
키워드 : folder, listing, iterate레퍼런스 : How do I list the files in a directory?
No comments:
Post a Comment