View Single Post
  #2  
Old 12-05-2008, 09:44 AM
Rhodan
Hill Giant
 
Join Date: Oct 2006
Posts: 179
Default

I ended up making a perl script that creates an sql file.

first I do a "dir maps\*.map > filelist" to get the .map names, then run the perl script which takes the names, drops the .map extention, and stuffs them into an insert statment.


Code:
#! /usr/bin/perl

print "Getting map names.";

$in_file="filelist";
$out_file="zonelist.sql";

open(IN,"<$in_file") or die "Can't open $in_file: $!\n";
open(OUT,">$out_file") or die "Can't open $out_file: $!\n";

print OUT "use peq;\n";

while ($line=<IN>) {
	$line = substr($line,0,length($line)-5);
	print OUT "insert into launcher_zones VALUES ('zone','$line',0);\n";
}

close IN;
close OUT;
Reply With Quote