|
发表于 2005-7-1 14:09:15
|
显示全部楼层
#======================================#
# List Directory
#= List ===============================#
sub ls {
local ($buffer, $dirname, @list, %list, $j);
$buffer = shift;
#-- dirname --#
$dirname = $buffer?$buffer:'.';
opendir (DIR, $dirname)
or return;
@list = readdir (DIR);
closedir (DIR)
or return;
$main'object{'objectName'} = $buffer;
foreach (@list) {
$j = "$dirname/$_";
-e $j
and $main'object{'subObjectNum'}++;
-d $j
and $_ ne '.'
and $_ ne '..'
and $main'object{'subDirectoryNum'}++;
-f $j
and $main'object{'subFileNum'}++;
@$_ = stat $j;
$list{$_} = \@$_;
}
return (\%list);
}
用在了自己的网站上的,懒得改照搬了. |
|