View difference between Paste ID: bEQyxNLd and gz93V0C2
SHOW: | | - or go back to the newest paste.
1
::WRITEN BY DUXA 8/14/2018
2-
::VERSION 1.5 UPDATED 8/18/2018
2+
3-
::NOTE: THIS CODE WAS USED ON STEAM BY SOMEONE ELSE AND PRESENTED AS IF IT WAS THEIR OWN. THIS IS NOT ALLOWED UNDER THE COPYRIGHT. PLEASE DO NOT USE ANY OTHER VERSIONS AS THEY MAY CONTAIN MALICIOUS CODE. DMCA COMPLAINT HAS BEEN SUBMITTED AGAINST THOSE PERSONS AND THEIR ACCOUNTS. YOU ARE FREE TO USE THIS CODE AND POST ABOUT IT, AS LONG AS CREDIT TO ORIGINAL AUTHOR (DUXA) AND A LINK IS GIVEN.
3+
4
:: 1 - Download 7zip CMD verson. Its the 3rd link down on 7zip downloads or use direct link 
5
::     https://www.7-zip.org/a/7z1805-extra.7z and place it either in C:\7z_console or elsewhere
6-
:: 1 - Copy/Pasta this whole thing into a text file and end it with .bat, for example "MonsterHunterBackup.bat"
6+
::     but if you place it elsewhere then you need to change the SZIPPATH path below
7-
::     Edit PATH below by replacing XXXXX with your steam user ID. Just follow the path to where the game is
7+
8-
::     saved and you will see your ID as the name of the folder before you reach 582010 folder.
8+
::     Windows does not have compresion via CMD by default, and not using compression would be silly since 9MB file 
9-
 
9+
::     is compressed down to ~30kb. Thats 99.7% compression. 7zip was chosen because its free and very good.
10-
:: OPTIONAL: You can make Windows Scheduler run this script at whatever interval you want.
10+
::     Note: If you already have 7zip you can change the path to point to it, but note non cmd version is 7z.exe not 7za.exe
11-
::     If CHK below is set to 1 it will only back up saves if there was an actual change to the file.
11+
::     so you will need to adjust that on line 92.
12-
::     Alternatively you can run this script in the background while you play without scheduling it. Set TIMER=1
12+
13-
::     It will ask you how often you want to do backups (in minutes), then just minimize it and let it do backups 
13+
:: 2 - Copy/Pasta this whole thing into a text file and end it with .bat, for example "MonsterHunterBackup.bat" 
14-
::     while you play.
14+
::     Edit paths below by replacing XXXXX with your steam user ID. Just follow the path to where the game is
15-
 
15+
::     saved and you will see your ID as the name of the folder before you reach 582010 folder. 
16-
::     If you have 7zip installed it will be used. If you have WinRar then it will be used. If you have neither
16+
::     No way for me to know what your ID is so you gotta do this yourself.
17-
::     the standard zip will be used. The backups are stored in BACKUPPATH path below. You can change it to whatever 
17+
::     NOTE: Non Windows 10 users change CHK=1 to be CHK=0 below. Non Win10 support is possible but I think most are on Win10
18-
::     location you want. Note that a log is kept, so that you can go back and see when backups were done. The log is
18+
19-
::     in the same directory as the backups. Also two text files containing previous/current checksums are kept
19+
:: 3 - OPTIONAL: you can make Windows Scheduler run this script at whatever interval you want, backup every
20
::     10 minutes? No problem, every hour? No problem. If CHK below is set to 1 it will only back up saves if 
21-
 
21+
::     there was an actual change to the file. 
22
::     I noticed save file changes upon loading and upon saving. Quitting without saving does not modify it.
23
::     If you are not on Windows 10 you can not use this due to different formatting on previous Win versions.
24
::     So if you are on Windows 7 you can still use the backup functionality, but you just have to set CHK to 0 
25-
SETLOCAL EnableDelayedExpansion
25+
::     so it will backup every time you or scheduler runs it.
26-
::================================CHANGE THESE AS NEEDED=====================================
26+
27
::     By default the backups are saved as .7z files in BACKUPPATH path below (your user folder)
28
::     You can change it by editing BACKUPPATH. 
29-
set PATH=C:\Program Files (x86)\Steam\userdata\XXXXX\582010
29+
::     Note that a log is kept, so that you can go back and see when backups were done. They will
30-
::Location to save the backups to
30+
::     be in the same directory as the backups. Also two text files containing previous/current checksums are kept
31-
set BACKUPPATH=%USERPROFILE%\Documents\Monster Hunter World Save Backups
31+
32-
::Log path
32+
33
:: For any questions find me on Reddit /u/Chrushev
34-
::FLAG to do a backup only if save has changed, set to 0 if want to backup no matter what
34+
35
@echo off
36-
::If you dont want to schedule it and instead would like to use this script as something you run while you play 
36+
:: CHANGE THESE AS NEEDED
37-
::in the background then set TIMER=1. It will ask you how often you want to run it (in minutes).
37+
38-
set /a TIMER=0
38+
39-
::Date format - Possible options are US, EU, YMD. Examples: US 08/17/2018 | EU 17/08/2018 | YMD 2018/08/17
39+
set PATH=C:\Program Files (x86)\Steam\userdata\102139856\582010\remote
40-
set DATEFORMAT=US
40+
::Location to save the file to. (replace XXXXX with your user ID)
41-
::If you are not using default path for 7zip or WinRar you can change them here
41+
set BACKUPPATH=C:\Program Files (x86)\Steam\userdata\102139856
42-
::It is ok to not have either, then standard zip format will be used if thats the case
42+
::Location of 7zip cmd version (can be obtained from https://www.7-zip.org/a/7z1805-extra.7z)
43-
::Reasons to use 7zip - Better compression, free (WILL BE PREFERRED OVER WINRAR IF INSTALLED)
43+
set SZIPPATH=C:\7z_console
44-
::Reasons to use WinRar - Has 5% baked in recovery in case recovery is needed
44+
::Log path (by default uses the same path as the backups)
45-
set SZIPPATH=C:\Program Files\7-Zip
45+
46-
set WRARPATH=C:\Program Files\WinRAR
46+
::FLAG to check only if save file changed, set to 0 if want to backup no matter what
47
::THIS ONLY WORKS ON WINDOWS 10 due to formatting! TURN OFF OTHERWISE BY SETTING TO 0
48-
::============DO NOT CHANGE ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING================
48+
49-
if %DATEFORMAT% == US goto DATEVALID
49+
50-
if %DATEFORMAT% == EU goto DATEVALID
50+
::DO NOT CHANGE ANYTHING UNDERNEATH UNLESS YOU KNOW WHAT YOU ARE DOING
51-
if %DATEFORMAT% == YMD goto DATEVALID
51+
if exist "%SZIPPATH%" goto CHECKPATH
52-
cls
52+
53
echo ERROR! 
54-
echo Invalid date format %DATEFORMAT%
54+
echo Cannot find 7-zip
55-
echo Must be either US, EU or YMD
55+
echo Download the cmd version from https://www.7-zip.org/download.html
56-
echo.
56+
echo and place it in the path listed above.
57
pause
58
goto END
59-
:DATEVALID
59+
60-
if %DATEFORMAT% == US set DF=MM-dd-yyyy_HH-mm-ss
60+
61-
if %DATEFORMAT% == EU set DF=dd-MM-yyyy_HH-mm-ss
61+
if exist "%PATH%" goto RUN
62-
if %DATEFORMAT% == YMD set DF=yyyy-MM-dd_HH-mm-ss
62+
63-
set /a USESZIP=0
63+
64-
set /a USEWRAR=0
64+
65-
if exist "%SZIPPATH%" (set /a USESZIP=1)
65+
66-
if %USESZIP% EQU 1 goto SKIPWINRAR
66+
67-
if exist "%WRARPATH%" (set /a USEWRAR=1)
67+
68-
:SKIPWINRAR
68+
69-
if %TIMER% == 0 goto SKIPTIMER
69+
70
71-
set /p CLK="How often do you want to backup (enter minutes): "
71+
72-
set /a SECS=%CLK%*60 
72+
73-
:SKIPTIMER
73+
74-
if %USESZIP% == 0 goto CHECKWRAR
74+
	echo Previous: %%H
75-
if exist "%SZIPPATH%\7z.exe" (set SZIPPATH=%SZIPPATH%\7z.exe) else (set SZIPPATH=%SZIPPATH%\7za.exe)
75+
76-
if exist "%SZIPPATH%" (color 0A & echo Found 7zip & goto CHECKPATH)
76+
77-
cls
77+
78-
color 0E
78+
	echo Current:  %%H
79-
echo WARNING! 
79+
80-
echo Cannot find 7-zip in %SZIPPATH%
80+
81-
echo Download it from https://www.7-zip.org/download.html
81+
82-
echo.
82+
	echo Checksums match. New backup NOT needed.
83-
echo Checking for WinRar
83+
84
	echo If you would like to backup either way, please set CHK=0 in the script. >> "%LOGPATH%\MHW_saves_log.txt"
85-
:CHECKWRAR
85+
	goto END
86-
if exist "%WRARPATH%\rar.exe" (set /a USEWRAR=1 & set /a USESZIP=0 & echo Found WinRar & color 0D) else (color 0F
86+
87-
	echo Could not find 7zip or Winrar
87+
88-
	echo Falling back to standard zip
88+
89-
	set /a USESZIP=0
89+
90-
	set /a USEWRAR=0)
90+
91
set FILENAME=MHW_Save_%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%-%time:~3,2%-%time:~6,2%
92
"%SZIPPATH%\7za.exe" a -y "%BACKUPPATH%\%FILENAME%" "%PATH%"
93-
if exist "%PATH%" goto CHECKBACKUPPATH
93+
if exist "%BACKUPPATH%\%FILENAME%.7z" echo Saved %FILENAME% >> "%LOGPATH%\MHW_saves_log.txt"
94-
cls
94+
95
:END