1use DirHandle;
2use AutoSplit;
3
4sub splitthis {
5my ($top,$base,$dest) = @_;
6my $d = new DirHandle $base;
7if (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
24splitthis $ARGV[0],$ARGV[0],$ARGV[1];
25