Last active
January 24, 2023 18:07
-
-
Save BrynM/b2fc0280878c57899ca4519d8e53615f to your computer and use it in GitHub Desktop.
NMS Save Backup Batch File
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
Put the batch file in your HelloGames directory and create a shortcut to use it | |
on your desktop or something. On my windows machine, that directory is something | |
like `C:\Users\BrynM\AppData\Roaming\HelloGames`. | |
You'll also need a `zip` program in your `$PATH` such as 7zip (https://www.7-zip.org/). |
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 | |
setlocal ENABLEDELAYEDEXPANSION | |
REM User settings | |
set nmsSaveDir=NMS | |
set outDir=%nmsSaveDir%_backups | |
REM Automated settings | |
set goodDate=!date:~10,4!!date:~4,2!!date:~7,2! | |
set timestamp=%goodDate%_%time::=.% | |
echo Timestamp: %timestamp% | |
set outFile=NMS_%timestamp%.zip | |
REM Do things and stuff. | |
if not exist %outDir% ( echo Creating directory "%outDir%"... ) && ( mkdir %outDir% ) | |
echo Checking "%outDir%\%outFile%"... | |
if exist %outDir%\%outFile% goto failsafe | |
echo Zipping "%outDir%\%outFile%"... | |
REM Let's keep backups but remember how the option is used. | |
REM zip -r9 %outDir%\%outFile% %nmsSaveDir% -x %nmsSaveDir%?Backup* | |
( zip -r9 %outDir%\%outFile% %nmsSaveDir% ) && ( echo Writing "%outDir%\%outFile%" complete. ) | |
goto ending | |
REM GOTO! HAHA! | |
:failsafe | |
echo Error - File "%outDir%\%outFile%" exists^^! | |
echo Aborted^^! | |
pause | |
:ending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment