my $serpath="D:\\eproof\\htdocs\\*\\work";
####
my @xmlfile = File::Find::Rule->file()
->name( '*.xml')
->in( glob $serpath );
####
#!/usr/bin/perl --
use strict;
use warnings;
use Shell::Command qw( rm_rf touch mkpath );
use File::Find::Rule;
use File::Spec::Functions;
my $serpath = './temptest1'; # no trailing slash
my $work = 'work';
my $time = int rand 20;
mkpath( catfile( $serpath, $time, $work ) );
touch( map { catfile( $serpath, $time, $work, "$_.xml" ) } 1 .. 2 );
#touch(catfile( $serpath, $time, $work, "$_.xml" )) for 1 .. 2;
{
my @dirs = File::Find::Rule->directory->name($work)->in($serpath);
print "dir $_\n" for @dirs;
my @xmlfile = File::Find::Rule->file->name('*.xml')->in(@dirs);
print "file $_\n" for @xmlfile;
}
print "wow $_\n"
for File::Find::Rule->file->name('*.xml')
->in( glob catfile( $serpath, '*', $work ) );
mkpath("$serpath/$time/$work");
rm_rf('temptest1');
__END__
C:\>perl file.find.rule.pl
dir temptest1/3/work
file temptest1/3/work/1.xml
file temptest1/3/work/2.xml
wow temptest1\3\work/1.xml
wow temptest1\3\work/2.xml
C:\>perl file.find.rule.pl
dir temptest1/15/work
file temptest1/15/work/1.xml
file temptest1/15/work/2.xml
wow temptest1\15\work/1.xml
wow temptest1\15\work/2.xml