Skip to content

Instantly share code, notes, and snippets.

@lambdan
Created September 22, 2018 17:32
Show Gist options
  • Save lambdan/a2e4a8fa7c0b21ffd807056d75d33feb to your computer and use it in GitHub Desktop.
Save lambdan/a2e4a8fa7c0b21ffd807056d75d33feb to your computer and use it in GitHub Desktop.
backup save files to a .wim archive (duplicate files won't take any additional space)
@echo off
REM SET UP CURRENT DATE TIME AND CREATE FOLDER
for /f "skip=1" %%i in ('wmic os get localdatetime') do if not defined fulldate set fulldate=%%i
set year=%fulldate:~0,4%
set month=%fulldate:~4,2%
set day=%fulldate:~6,2%
set CUR_HH=%time:~0,2%
if %CUR_HH% lss 10 (set CUR_HH=0%time:~1,1%)
set CUR_NN=%time:~3,2%
set CUR_SS=%time:~6,2%
set CUR_MS=%time:~9,2%
set foldername="%temp%\%year%-%month%-%day%-%CUR_HH%%CUR_NN%%CUR_SS%"
md %foldername%
REM COPY SAVE FILES
robocopy /mir "C:\Users\djs\Documents\GTA San Andreas User Files" "%foldername%\GTA San Andreas User Files"
robocopy /mir "C:\Users\djs\Documents\GTA Vice City User Files" "%foldername%\GTA Vice City User Files"
robocopy /mir "C:\Users\djs\Documents\GTA3 User Files" "%foldername%\GTA3 User Files"
robocopy /mir "C:\Users\djs\Documents\Rockstar Games" "%foldername%\Rockstar Games"
robocopy /mir "C:\Users\djs\Documents\My Games" "%foldername%\My Games"
robocopy /mir "C:\Users\djs\Documents\The Witcher 3" "%foldername%\The Witcher 3"
robocopy /mir "C:\Users\djs\Documents\Electronic Arts" "%foldername%\Electronic Arts"
robocopy /mir "C:\Users\djs\Documents\Warcraft III" "%foldername%\Warcraft III"
REM COMPRESS
7z a -mx9 "Backup.wim" "%foldername%"
rmdir /s /q "%foldername%"
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment