#!/usr/bin/perl
use warnings;
use strict;
my ($Filepath) = @ARGV;
sub scan_file{
my @files = glob(@_[0]);
foreach (@files){
#-d为目录
if(-d $_){
my $Filepath = "$_/*";
print "Filepath=$Filepath\n";
scan_file($Filepath);
#-f为普通文本
}elsif(-f $_){
print "file $_\n";
}
}
}
scan_file($Filepath);
脚本
输出