perl faq 学习之递归遍历目录
目的:遍历目录。
#!/usr/bin/perl use warnings; use File::Find; @directories = (".", "path2traverse"); # 递归遍历指定目录(@directories),并在回调函数(wanted)中处理。 find(\&wanted, @directories); sub wanted{ # $File::Find::dir is the current directory name, # $_ is the current filename within that directory # $File::Find::name is the complete pathname to the file. print "full path is $File::Find::name, filename is $_\n"; }
原文:
http://faq.perl.org/perlfaq5.html#How_do_I_traverse_a_
更多:
http://perldoc.perl.org/File/Find.html
相关推荐
清溪算法君老号 2020-06-27
oXiaoChong 2020-06-20
baike 2020-05-09
Tips 2020-05-03
大地飞鸿 2020-11-12
steeven 2020-11-10
匆匆那些年 2020-10-15
Tips 2020-10-14
nongfusanquan0 2020-08-18
yedaoxiaodi 2020-07-26
夜晚00 2020-07-03
hanyujianke 2020-06-28
xhao 2020-06-28
pengkingli 2020-06-25
yishujixiaoxiao 2020-06-25
Masimaro 2020-06-21
清溪算法 2020-06-21
RememberMePlease 2020-06-17