Last active
August 29, 2015 14:05
-
-
Save ianchanning/d1b7b041d919a7ed1049 to your computer and use it in GitHub Desktop.
Backup the minecraft saves directory (uses 7-zip)
This file contains hidden or 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 | |
REM Backup the mincraft saves directory (uses 7-zip) | |
REM @author ICC 10 Aug 2014 | |
REM @licence MIT | |
REM usage backs up the user saves directory to the current directory | |
REM gives the filename .minecraft-saves.[User]-[Computer]-YYYY-MM-DD.bak.7z | |
REM create date in YYYY-MM-DD format | |
FOR /f "tokens=1-3 delims=/ " %%a IN ('date /t') DO (SET today=%%c-%%b-%%a) | |
REM Computer name | |
SET ip_config_host="Host Name" | |
FOR /f "usebackq tokens=2 delims=:" %%f IN (`ipconfig /all ^| findstr /c:%ip_config_host%`) DO SET host=%%f | |
REM trim left spaces | |
REM @link http://www.dostips.com/DtTipsStringManipulation.php#Snippets.TrimLeftFOR | |
FOR /f "tokens=* delims= " %%g IN ("%host%") DO SET host=%%g | |
REM Backup using 7-zip | |
SET orig_dir=%CD% | |
C: | |
CD "%APPDATA%\.minecraft\" | |
SET file=%orig_dir%\.minecraft-saves.%USERNAME%-%host%-%today% | |
REM ECHO %file% | |
7z a -t7z %file%.bak.7z saves | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment