Skip to content

Instantly share code, notes, and snippets.

@Trinitek
Created October 19, 2014 19:52
Show Gist options
  • Save Trinitek/0639755b59f2a79f1b0c to your computer and use it in GitHub Desktop.
Save Trinitek/0639755b59f2a79f1b0c to your computer and use it in GitHub Desktop.
Phaeton Minecraft Server - backup.bat
@echo off
set worldName="world3"
:start
echo %0 n [/c] [/w] [/l] [/p]
echo. n - string to append to end of output filename
echo. /c - backup root files
echo. /w - backup world directory
echo. /l - backup log directory
echo. /p - backup plugin directory
echo. /a - backup patch directory
if "%2"=="/c" goto backupRoot
if "%2"=="/w" goto backupWorld
if "%2"=="/l" goto backupLogs
if "%2"=="/p" goto backupPlugins
if "%2"=="/a" goto backupPatches
goto end
:backupPatches
if exist "backup\patch-%1.7z" goto alreadyExists
7z a "backup\patch-%1.7z" patch
goto end
:backupRoot
if exist "backup\config-%1.7z" goto alreadyExists
7z a "backup\config-%1.7z" *.*
goto end
:backupWorld
if exist "backup\world-%1.7z" goto alreadyExists
7z a "backup\world-%1_overworld.7z" %worldName%
7z a "backup\world-%1_nether.7z" %worldName%_nether
7z a "backup\world-%1_the_end.7z" %worldName%_the_end
goto end
:backupLogs
if exist "backup\logs-%1.7z" goto alreadyExists
7z a "backup\logs-%1.7z" logs
goto end
:backupPlugins
if exist "backup\plugins-%1.7z" goto alreadyExists
7z a "backup\plugins-%1.7z" plugins
goto end
:alreadyExists
echo That archive already exists. Operation aborted.
set ERRORLEVEL=1
:end
set ERRORLEVEL=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment