Leser: 20
1 2 3 4 5
my $server = 'E:'; my $folder = 'A_TMP'; my $regex = qr{/\.\d.+}; rmtree($server."\\".$folder) if (-d $server."\\".$folder.$regex);
1 2
opendir my $FHDIR, $server or die $!; while(my $tmp = readdir $FHDIR){ ...und so weiter ...}
1 2 3 4 5 6 7 8 9 10 11 12
use File::Find; #... sub dir_has { my $base=shift; my $reg=shift; my $ok=0; find(sub{ $_=~$reg && $ok++ },$base) return $ok; }
rmtree($server."\\".$folder) if (dir_has("$server\\$folder",$regex));
1 2 3 4
use File::Spec; my $path=File::Spec->join($server,$folder); rmtree($path) if (dir_has($path,$regex));