Last active
April 15, 2016 14:19
-
-
Save Drethic/5ac899e7c45545067832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enableextensions enabledelayedexpansion | |
set pwd=%~dp0 | |
:: Check if folder exists | |
if exist "C:\Program Files\7-Zip\7z.exe" ( | |
echo."7z.exe was found in C:\Program Files\7-Zip\" | |
set zip="C:\Program Files\7-Zip" | |
) else if exist "C:\Program Files (x86)\7-Zip\7z.exe" ( | |
echo."7z.exe was found in C:\Program Files (x86)\7-Zip\" | |
set zip="C:\Program Files (x86)\7-Zip" | |
) else ( | |
echo."Could not find 7-Zip installed in C:\Program Files\7-Zip or C:\Program Files (x86)\7-Zip. Please verify it is installed or modify the batch to the correct location." | |
pause | |
exit | |
) | |
echo %zip% | |
IF exist ..\modpack ( | |
echo modpack exists, removing | |
rmdir /s /q ..\modpack | |
) | |
echo | |
cd .. | |
mkdir modpack | |
cd modpack | |
for %%A in (.) do set pack=%%~dpnA | |
echo modpack created | |
cd %pwd% | |
IF exist ..\modpacktmp ( | |
echo modpacktmp exists, removing | |
rmdir /s /q ..\modpacktmp | |
) | |
cd .. | |
mkdir modpacktmp | |
cd modpacktmp | |
for %%A in (.) do set packtmp=%%~dpnA | |
echo modpacktmp created | |
cd %pwd% | |
echo %pack% | |
echo %packtmp% | |
echo pretty_name,name,author,description,link,donatelink>>"%pack%\modpack.csv" | |
:: Iterate over all files in directory | |
for /f "Tokens=*" %%f in ('dir /l/b/a-d *.jar *.litemod') do ( | |
set file=%%f | |
set file=!file:_=-! | |
set file=!file:-[1.7.10]=-! | |
set file=!file:journeymap=journeymap-! | |
set file=!file:computercraft=computercraft-! | |
set file=!file:harvestcraft=harvestcraft-! | |
set file=!file:customnpcs=customnpcs-! | |
set file=!file:[v=-v! | |
set file=!file:[bio=-bio! | |
set file=!file:[for=-for! | |
set file=!file:[nat=-nat! | |
set file=!file:[=! | |
set file=!file: - mc 1.7.10=! | |
set file=!file:-mc1.7.10=! | |
set file=!file:-mc1710=! | |
set file=!file:mc1.7.10=! | |
set file=!file:-mc1.7.x=! | |
set file=!file:-mc1.7=! | |
set file=!file:-1.7.2=! | |
set file=!file:1.7.10-=! | |
set file=!file:-1.7.10=! | |
set file=!file: 1.7.10=! | |
set file=!file:^(1.7.10^)=! | |
set file=!file:1.7.10=! | |
set file=!file:-1.7.x=! | |
set file=!file:]=! | |
set file=!file:-universal=! | |
set file=!file:-for=! | |
set file=!file:mod-=! | |
set file=!file:'=! | |
set file=!file: =-! | |
set file=!file:.jar=! | |
set file=!file:.litemod=! | |
echo Creating mod file: !file! | |
echo ,!file!>>"%pack%\modpack.csv" | |
mkdir "%packtmp%\!file!\mods" | |
copy "%%f" "%packtmp%\!file!\mods">nul: | |
echo.!file! | findstr /C:"ruins">nul && ( | |
echo Found Ruins: Adding resources and associated text files. | |
echo d | xcopy resources "%packtmp%\!file!\mods\resources" /T/E>nul: | |
copy ruins*.txt "%packtmp%\!file!\mods">nul: | |
) | |
%zip%\7z.exe a -tzip "%pack%\!file!\!file!.zip" "%packtmp%\!file!\*" -mx0>nul: | |
rem %zip%\7z.exe a -tzip "%pack%\!file!.zip" "%packtmp%\!file!\*" -mx0>nul: | |
) | |
rmdir /s /q ..\modpacktmp | |
endlocal | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment