1.

Solve : Batch File Archive Extract/Move contents?

Answer»

Hello guys!

I'm CURRENTLY writing a compilation for a game (Elder Scrolls Oblivion) that instead of packaging all mods together at distribution, simply packages metadata and installation data. The end-user is still required to DOWNLOAD the mods from their sites. The benefit of this is that I don't have to ask for distribution permissions from the author. I'm using a PROGRAM called Fallout Mod Manager to determine whether or not a user has the correct archives. If the user does not have the correct archive, then a download link will be displayed. If the user does have the correct archive, than the archive will be extracted and portions of its contents will go into one folder, and the other portions elsewhere.

Currently, I had to do a little hackjob in FOMM to make sure it recognizes Oblivion. but even then I find it silly I'm forcing players to download a mod manager when all it did was extract/mod files.

I've been told that I can accomplish the same thing with batch files through a (apparently) simple process.

Here is a sample .xml snippet to show you what FOMM does. This snippet only moves AROUND the patches of the compilation.

Code: [Select]<premadeFomodPack>
<sources>
<source name="Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z" url="http://www.tesnexus.com/downloads/file.php?id=5296" />
<source name="v1_4_0_Manual_install_7Z_version-10739.7z" url="http://www.tesnexus.com/downloads/file.php?id=10739" />
<source name="Unofficial_Official_Mods_Patch_v15_Manual_Version-9969.7z" url="http://www.tesnexus.com/downloads/file.php?id=9969" />
<source name="Unofficial_Patch_Supplementals-27710-3-3-7.7z" url="http://www.tesnexus.com/downloads/download.php?id=82357" />
<source name="DLC_MOBS-19203-1-02.zip" url="http://www.tesnexus.com/downloads/download.php?id=19203" />
<source name="SM_Plugin_Refurbish_1-30-11474.zip" url="http://www.tesnexus.com/downloads/file.php?id=11474" />
<source name="OCM - BAIN.7z" url="http://www.tesnexus.com/downloads/file.php?id=39868" />
</sources>
<customHowToSteps />
<copyInstructions>
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Meshes" destination="0000 Core\meshes" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Sound" destination="0000 Core\Sound" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Textures" destination="0000 Core\Textures" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Trees" destination="0000 Core\Trees" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Unofficial Oblivion Patch\Readme.html" destination="9999 OCMDocs\OCM - Unofficial Oblivion Patch.html" />
<instruction source="arch:v1_4_0_Manual_install_7Z_version-10739.7z//Data\Meshes" destination="0010 UOMPSI\meshes" />
<instruction source="arch:v1_4_0_Manual_install_7Z_version-10739.7z//Data\Sound" destination="0010 UOMPSI\Sound" />
<instruction source="arch:v1_4_0_Manual_install_7Z_version-10739.7z//Data\Textures" destination="0010 UOMPSI\Textures" />
<instruction source="arch:v1_4_0_Manual_install_7Z_version-10739.7z//Unofficial Shivering Isles Patch\Readme.html" destination="9999 OCMDocs\OCM - Unofficial Shivering Isles Patch.html" />
<instruction source="arch:Unofficial_Official_Mods_Patch_v15_Manual_Version-9969.7z//Data\Meshes" destination="0000 Core\meshes" />
<instruction source="arch:Unofficial_Official_Mods_Patch_v15_Manual_Version-9969.7z//Data\Sound" destination="0000 Core\Sound" />
<instruction source="arch:Unofficial_Official_Mods_Patch_v15_Manual_Version-9969.7z//Data\Textures" destination="0000 Core\Textures" />
<instruction source="arch:Unofficial_Official_Mods_Patch_v15_Manual_Version-9969.7z//Data\DLCSpellTomes - Unofficial Patch.ESP" destination="0010 UOMPST\DLCSpellTomes - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Official_Mods_Patch_v15_Manual_Version-9969.7z//Unofficial Official Mods Patch\Unofficial Official Mods Patch Readme.html" destination="9999 OCMDocs\OCM - Unofficial Official Mods Patch.html" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//00 Unofficial Oblivion Patch Supplemental\Meshes" destination="0000 Core\meshes" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//00 Unofficial Oblivion Patch Supplemental\Sound" destination="0000 Core\Sound" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//00 Unofficial Oblivion Patch Supplemental\Textures" destination="0000 Core\Textures" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//00 Unofficial Oblivion Patch Supplemental\Unofficial Oblivion Patch.esp" destination="0000 Core\Unofficial Oblivion Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//09 Unofficial Shivering Isles Patch Supplemental\Unofficial Shivering Isles Patch.esp" destination="0010 UOMPSI\Unofficial Shivering Isles Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//09 Unofficial Shivering Isles Patch Supplemental\meshes" destination="0010 UOMPSI\mesh" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//09 Unofficial Shivering Isles Patch Supplemental\sound" destination="0010 UOMPSI\sound" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//01 DLC Battlehorn Castle Unofficial Patch\DLCBattlehornCastle - Unofficial Patch.esp" destination="0010 UOMPBH\DLCBattlehornCastle - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//02 DLC Frostcrag Spire Unofficial Patch\DLCFrostcrag - Unofficial Patch.esp" destination="0010 UOMPFC\DLCFrostcrag - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//03 DLC Horse Armor Unofficial Patch\DLCHorseArmor - Unofficial Patch.esp" destination="0010 UOMPHA\DLCHorseArmor - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//04 DLC Mehrunes Razor Unofficial Patch\DLCMehrunesRazor - Unofficial Patch.esp" destination="0010 UOMPMR\DLCMehrunesRazor - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//05 DLC Orrery Unofficial Patch\DLCOrrery - Unofficial Patch.esp" destination="0010 UOMPOR\DLCOrrery - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//06 DLC Thieves Den Unofficial Patch\DLCThievesDen - Unofficial Patch.esp" destination="0010 UOMPTD\DLCThievesDen - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//07 DLC Vile Lair Unofficial Patch\DLCVileLair - Unofficial Patch.esp" destination="0010 UOMPVL\DLCVileLair - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//08 Knights of the Nine Unofficial Patch\Knights - Unofficial Patch.esp" destination="0010 UOMPKN\Knights - Unofficial Patch.esp" />
<instruction source="arch:Unofficial_Patch_Supplementals-27710-3-3-7.7z//Unofficial Patch Supplementals README.txt" destination="9999 OCMDocs\OCM - Unofficial Patch Supplementals.txt" />
<instruction source="arch:DLC_MOBS-19203-1-02.zip//Battlehorn_mobs.esp" destination="0015 DLCMBH\Battlehorn_mobs.esp" />
<instruction source="arch:DLC_MOBS-19203-1-02.zip//Lair_mobs.esp" destination="0015 DLCMVL\Lair_mobs.esp" />
<instruction source="arch:DLC_MOBS-19203-1-02.zip//Mehrunes_mobs.esp" destination="0015 DLCMMR\Mehrunes_mobs.esp" />
<instruction source="arch:DLC_MOBS-19203-1-02.zip//Thievesden_mobs.esp" destination="0015 DLCMTD\Thievesden_mobs.esp" />
<instruction source="arch:DLC_MOBS-19203-1-02.zip//DLC_MOBS.esp" destination="0015 DLCMC\DLC_MOBS.esp" />
<instruction source="arch:DLC_MOBS-19203-1-02.zip//readme.txt" destination="9999 OCMDocs\OCM - DLC MOBS Patch.txt" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Full Plugin\SM Plugin Refurbish(Merged).esp" destination="0025 SMPluginM\SM Plugin Refurbish(Merged).esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - Battlehorn.esp" destination="0025 SMPluginBH\SM Plugin Refurbish - Battlehorn.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - Frostcrag.esp" destination="0025 SMPluginFC\SM Plugin Refurbish - Frostcrag.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - HorseArmor.esp" destination="0025 SMPluginHA\SM Plugin Refurbish - HorseArmor.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - Knights.esp" destination="0025 SMPluginKN\SM Plugin Refurbish - Knights.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - MehrunesRazor.esp" destination="0025 SMPluginMR\SM Plugin Refurbish - MehrunesRazor.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - Orrery.esp" destination="0025 SMPluginOR\SM Plugin Refurbish - Orrery.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - SI.esp" destination="0025 SMPluginSI\SM Plugin Refurbish - SI.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - ThievesDen.esp" destination="0025 SMPluginTD\SM Plugin Refurbish - ThievesDen.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//00 Individual Plugins\SM Plugin Refurbish - VileLair.esp" destination="0025 SMPluginVL\SM Plugin Refurbish - VileLair.esp" />
<instruction source="arch:SM_Plugin_Refurbish_1-30-11474.zip//SM Plugin Refurbish.txt" destination="9999 OCMDocs\OCM - SM Plugin Refurbish.txt" />
<instruction source="arch:OCM - BAIN.7z//wizard.txt" destination="wizard.txt" />
</copyInstructions>
</premadeFomodPack>

It allows me to extract the stuff I want from an archive and move it around as I wish. But again, I'm forcing users to download a mod manager for another game to simply do this for them... so it's a bit clunky and unprofessional. I would like to declare things
a) what directory the source archives can be found
b) if a archive cannot be found, then where to find it
c) Where contents are extracted too
c) Extraction installations. i don't want to move all the contents in an archive to the same folder. Sometimes there is junk. For example,

Code: [Select] <instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Meshes" destination="0000 Core\meshes" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Sound" destination="0000 Core\Sound" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Textures" destination="0000 Core\Textures" />
<instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\Trees" destination="0000 Core\Trees" />
I could have just written

Code: [Select] <instruction source="arch:Unofficial_Oblivion_Patch_v3_2_0_Manual_Version-5296.7z//Data\" destination="0000 Core\" />
But there were a few junk files in the data directory of that archive.

Basically, I would like to do something like this.

If Archive Exists at directory then Installation Instructions and move to this directory. Else, link to missing archive here.

Is it possible to do this via batch file? And if so, could someone write a small template and/or direct me to a series of links and tutorials? I have very little batch experience... the only thing I have is the creativity to create hack-job conversions... but I'm willing to learn. It would speed up development and lower the amount of "required downloads" a user has to find.

Thank you very much for the help.



Discussion

No Comment Found