#!/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 (-l $name) {
print "symbolic link";
} elsif (-d $name) {
print "directory";
} elsif (-p $name) {
print "FIFO pipe";
} elsif (-f $name) {
print "normal file";
} else {
print "unknown file type";
}
}
|