Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239866
  • 博文数量: 19
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 435
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-15 15:40
文章分类

全部博文(19)

文章存档

2011年(1)

2010年(2)

2009年(5)

2008年(11)

我的朋友

分类:

2008-12-11 15:04:24

#!/usr/bin/perl
use strict;
use warnings;
my @tree=<*>;
foreach (@tree){
 &if_a_tree($_);
}
sub if_a_tree{
 if(-d){
  print "$_ is a directory\n";
  chdir $_;
  my @tree=<*>;
  foreach(@tree){
   &if_a_tree($_);
  }
  chdir "..";
 }
 if(-f){
  print "$_ just a file\n";
 }
}
 
 
输入  perl -w digui.pl [directory]
输出   <类似内容>
acl is a directory
clean.sh just a file
ns2 is a directory
named1.conf just a file
named2.conf just a file
named3.conf just a file
named4.conf just a file
setup.sh just a file
tests.sh just a file
cacheclean is a directory
clean.sh just a file
dig.batch just a file
knowngood.dig.out just a file
ns1 is a directory
阅读(1311) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~