#!/usr/bin/perl -w
$dir = "c:\\";
opendir(DIR, $dir) or die "Can't open $name due to $!";
@entries = readdir(DIR);
closedir(DIR);
@sorted = sort(@entries);
foreach $entry (@sorted) {
$name = $dir . '/' . $entry;
print "$name ";
if (-T $name) {
print ", text file ";
} elsif (-B $name) {
print ", binary file ";
}
print "\n"; # End line.
}