#!/usr/bin/perl


$outroot="/mtdata/geo";
$outschema "/mt/apps";

print "Now making the directories...........\n";

#making the main directory under /mt/apps
system "mkdir $outschema/gpms";
system "chmod 777 $outschema/gpms";

#making the main directory under /mtdata/
system "mkdir $outroot/gpms";
system "chmod 777 $outroot/gpms";


#Making the subdirectories under /mt/apps/gpms

system "mkdir $outschema/gpms/FGDC2MRF";
system "chmod 777 $outschema/gpms/FGDC2MRF";

system "mkdir $outschema/gpms/xsd";
system "chmod 777 $outschema/gpms/xsd";

system "mkdir $outschema/gpms/xsl";
system "chmod 777 $outschema/gpms/xsl";

#making the main directories under $outroot (/mtdata/geo)

system "mkdir $outroot/gpms/input";
system "chmod 777 $outroot/gpms/input";

system "mkdir $outroot/gpms/log";
system "chmod 777 $outroot/gpms/log";

system "mkdir $outroot/gpms/output";
system "chmod 777 $outroot/gpms/output";


#making the directories under input

system "mkdir $outroot/gpms/input/fgdc";
system "chmod 777 $outroot/gpms/input/fgdc";

system "mkdir $outroot/gpms/input/list";
system "chmod 777 $outroot/gpms/input/list";

system "mkdir $outroot/gpms/input/mif";
system "chmod 777 $outroot/gpms/input/mif";

#making the directories under output

system "mkdir $outroot/gpms/output/fgdc";
system "chmod 777 $outroot/gpms/output/fgdc";

system "mkdir $outroot/gpms/output/mrf";
system "chmod 777 $outroot/gpms/output/mrf";

#making the directory under xsl

system "mkdir $outschema/gpms/xsl/xsl4mrf2fgdc";
system "chmod 777 $outschema/gpms/xsl/xsl4mrf2fgdc";

print "Now moving the files to the appropriate directory ......\n"

# installing the FGDC2MRF files

$FGDC2MRF="$outschema/gpms/FGDC2MRF";

system "mv 01_idinfo_planned.xsl $FGDC2MRF";
system "mv 01_idinfo.xsl $FGDC2MRF";
system "mv 02_dataqual_map.xsl $FGDC2MRF";
system "mv 02_dataqual_tab.xsl $FGDC2MRF";
system "mv 02_dataqual.xsl $FGDC2MRF";
system "mv 03_spdoinfo.xsl $FGDC2MRF";
system "mv 04_spref.xsl $FGDC2MRF";
system "mv 05_eainfo.xsl $FGDC2MRF";
system "mv 06_distinfo.xsl $FGDC2MRF";
system "mv 07_metainfo.xsl $FGDC2MRF";
system "mv FGDC2mif_atlas.xsl $FGDC2MRF";
system "mv FGDC2mif_legacy.xsl $FGDC2MRF";
system "mv FGDC2mif_atlas.xsl $FGDC2MRF";
system "mv FGDC2mif_legacy.xsl $FGDC2MRF";
system "mv FGDC2mif_map.xsl $FGDC2MRF";
system "mv FGDC2mif_planned.xsl $FGDC2MRF";
system "mv FGDC2mif_tabular.xsl $FGDC2MRF";
system "mv FGDC2mif_vector.xsl $FGDC2MRF";
system "mv FGDC2mif.xsl $FGDC2MRF";

#installing the xsd files

$xsd="$outschema/gpms/xsd";

system "mv Atlas.xsd $xsd";
system "mv CitationInformation.xsd $xsd";
system "mv ContactInformation.xsd $xsd";
system "mv DataQualityInformation.xsd $xsd";
system "mv DistributionInformation.xsd $xsd";
system "mv EntityAndAttributeInformation.xsd $xsd";
system "mv IdentificationInformation.xsd $xsd";
system "mv Legacy.xsd $xsd";
system "mv Map.xsd $xsd";
system "mv MetadataReferenceInformation.xsd $xsd";
system "mv MiscTypesAndGroups.xsd $xsd";
system "mv Planned.xsd $xsd";
system "mv Repository.xsd $xsd";
system "mv SpatialDataOrganizationInformation.xsd $xsd";
system "mv SpatialReferenceInformation.xsd $xsd";
system "mv Tabular.xsd $xsd";
system "mv Test.xsd $xsd";
system "mv Vector.xsd $xsd";

#xsl files for the mrf
$xsl ="$outschema/gpms/xsl";

system "mv DataQualityInformation.xsl $xsl";
system "mv DistributionInformation.xsl $xsl";
system "mv EntityAndAttributeInformation.xsl $xsl";
system "mv IdentificationInformation.xsl $xsl";
system "mv MetadataReferenceInformation.xsl $xsl";
system "mv MIF2MRF.xsl $xsl";
system "mv SpatialDataOrganizationInformation.xsl $xsl";
system "mv SpatialReferenceInformation.xsl $xsl";

#xsl files for coverting MRF to FGDC CSDGM

$mrf2fgdc ="$outschema/gpms/xsl/xsl4mrf2fgdc";

system "mv 01_Identification_Information.xsl $mrf2fgdc";
system "mv 02_Data_Quality_Information.xsl $mrf2fgdc";
system "mv 03_Spatial_Data_Organization_Information.xsl $mrf2fgdc";
system "mv 04_Spatial_Reference_Information.xsl $mrf2fgdc";
system "mv 05_Entity_And_Attribute_Information.xsl $mrf2fgdc";
system "mv 06_Distribution_Information.xsl $mrf2fgdc";
system "mv 07_Metadata_Reference_Information.xsl $mrf2fgdc";
system "mv MRF2FGDC.xsl $mrf2fgdc";

#sample list file

system "mv test_list.txt  $outroot/gpms/input/list";

#sample fgdc files

system "mv fe_2007_06073_edges.shp.xml $outroot/gpms/input/fgdc";
system "mv fe_2007_06_place00.shp.xml $outroot/gpms/input/fgdc";
system "mv fe_2007_us_state.shp.xml $outroot/gpms/input/fgdc";

print "Now finished. The input, output and log directories can be found under $outroot/gpms\n";
print "The xsd, xsl and FGDC2MRF directories can be found under $outschema/gpms\n";
