Chinaunix首页 | 论坛 | 博客
  • 博客访问: 566625
  • 博文数量: 99
  • 博客积分: 3976
  • 博客等级: 中校
  • 技术积分: 1041
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-15 15:48
文章分类
文章存档

2009年(1)

2008年(5)

2007年(31)

2006年(58)

2005年(4)

分类:

2007-03-30 12:38:34

#!/usr/bin/perl -W
#
# File: output.pl
# Author: 1jjk

#mail:lingjiujianke@gmail.com
# License: GPL-2
use strict;
use warnings;
use File::Find;

 

print "finding now ,please wait..........\n";
my ($size, $dircnt, $filecnt) = (0, 0, 0);
open(II,">>qq.txt");
sub process {
    my $file = $File::Find::name;
    print II $file,"\n";
    if (-d $file) {
        $dircnt++;
    }
    else {
        $filecnt++;
        $size += -s $file;
    }
}

find(\&process , '/ftp');
print "$filecnt files, $dircnt directory. $size bytes.\n";
close(II);

 

[root@ljjk root]# perl a.pl
finding now ,please wait..........
然后会生成一个qq.txt文件

内容就不全发出来了,太多了,呵呵!!

 

参考文章,在ChinaUnix的perl版!

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