Rt2-to-rt3 - multiple DIRNAMEs

The README file to the rt2-rt3 exporter reads:

“DIRNAME will now contain one file called “metadata” and one file per
ticket.
That’s right. one file for each ticket. If you’ve got an RT instance with
250,000 tickets, you might want to consider altering these scripts so you
don’t
create a directory with 250,000 files in it. If you do, there are likely
other
users who’d greatly appreciate it if you posted them to rt-devel.”

The patch below does that. I only have 14k tickets but I had time on my
hands.

6,7c6
< my $export_dir = shift;
< my $export_dir_limit = 1000;

my $export_dir_base = shift;
8a8,15
my $export_dir_suffix = 0;

make this ridiculously large if you don’t want a limit

my $export_dir_limit = 1000;

my $export_dir = “$export_dir_base.$export_dir_suffix”;
&checkDirExists($export_dir);

251c258,269
< print STDERR "Exporting ticket " . $t->Id . “\n”;

print STDERR "Exporting ticket " . $t->Id . "\n";

$export_dir_counter ++;
  if ($export_dir_counter > $export_dir_limit) {
          $export_dir_suffix ++;
          $export_dir = "$export_dir_base.$export_dir_suffix";
          $export_dir_counter = 0;
          &checkDirExists($export_dir);
          print STDERR "* export_dir changed - $export_dir\n";

  }

322a341,347

sub checkDirExists {
my ($dir) = @_;
if ( ! ( -d “$dir”) ) {
mkdir (“$dir”, 0771);
}
}

matthew zeier | “Nothing in life is to be feared.
InteleNet Communications, Inc. | It is only to be understood.”
(949) 784-7904 | - Marie Curie