| 1 | use DirHandle; |
| 2 | use AutoSplit; |
| 3 | |
| 4 | sub splitthis { |
| 5 | my ($top,$base,$dest) = @_; |
| 6 | my $d = new DirHandle $base; |
| 7 | if (defined $d) { |
| 8 | while (defined($_ = $d->read)) { |
| 9 | next if $_ eq "."; |
| 10 | next if $_ eq ".."; |
| 11 | my $entry = "$base\\$_"; |
| 12 | my $entrywithouttop = $entry; |
| 13 | $entrywithouttop =~ s/^$top//; |
| 14 | if (-d $entry) {splitthis ($top,$entry,$dest);} |
| 15 | else { |
| 16 | next unless ($entry=~/pm$/i); |
| 17 | #print "Will run autosplit on $entry to $dest\n"; |
| 18 | autosplit($entry,$dest,0,1,1); |
| 19 | }; |
| 20 | }; |
| 21 | }; |
| 22 | } |
| 23 | |
| 24 | splitthis $ARGV[0],$ARGV[0],$ARGV[1]; |