#!/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版!
阅读(1278) | 评论(0) | 转发(0) |