#!/usr/bin/perl
use strict;
my $dir = $ARGV[0];
&fun ($dir);
sub
fun ()
{
my $current = shift;
opendir DIR, $current or die "can not open dir";
my @ list = readdir DIR;
foreach my $item (@list)
{
if (-f $current."/".$item)
{
print $item." is a file\n";
}
else
{
if (-d $current."/".$item && $item ! ~/^[\.]{1, 2}/)
{
print $item." is a directory\n";
&fun ($current."/".$item);
}
}
}
}
阅读(329) | 评论(0) | 转发(0) |