in reply to Rename All Files In a Directory
UPDATE: Or in chapter 9.5 of the Cookbook:@files = grep { -f "$dir/$_" } readdir(DH);
use DirHandle; sub plainfiles { my $dir = shift; my $dh = DirHandle->new($dir) or die "can't opendir $dir: $!"; return sort # sort pathnames grep { -f } # choose only "plain" files map { "$dir/$_" } # create full paths grep { !/^\./ } # filter out dot files $dh->read(); # read all entries }
|
---|