#!/usr/bin/perl

use strict;

my $ProgramDir      = "d:\\Programs";
my $MXDExecDir      = "$ProgramDir\\MD\\MXD\\exec";
my $MakeHistoryPath = "$MXDExecDir\\AddHistory.bat";
my $nInterval       = 100;
my $outfile         = "IGZO-History.csv";
my $outfile2        = "IGZO-History2.csv";

unlink($outfile);
unlink($outfile2);

my @dirs = sort glob("*");
for(my $i = 0 ; $i < @dirs ; $i++) {
	my $d = $dirs[$i];
	next if(!-d $d);
	my $f = "$d\\FILE06.DAT";
	next if(!-f $f);

	system("$MakeHistoryPath $f $outfile $nInterval");
}
system("$ProgramDir\\bin\\MXDFileConv.exe --Action=ConvF09p File09p.dat");
unlink("File09p.xsf");

exit;
