Chinaunix首页 | 论坛 | 博客
  • 博客访问: 203438
  • 博文数量: 39
  • 博客积分: 1057
  • 博客等级: 准尉
  • 技术积分: 926
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-27 20:13
文章分类

全部博文(39)

文章存档

2012年(24)

2011年(15)

分类: Python/Ruby

2012-03-17 13:13:45


点击(此处)折叠或打开

  1. #!/usr/bin/perl -w
  2. # name: total.pl
  3. # 统计目录下文件的数量、
  4. # 来源: Lover的工具小屋
  5. # author: Lover

  6. use strict;

  7. my $dir = shift || $ENV{'HOME'};
  8. my $total = 0;
  9. my $file;

  10. opendir DIR,$dir;
  11. while ( $file = readdir DIR){
  12.         next if $file eq '.' || $file eq '..';
  13.         $total += 1;
  14. }
  15. print("$total \n");
  16. closedir DIR;

阅读(2163) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~