Skip to content

Instantly share code, notes, and snippets.

@gordonglas
Created December 5, 2021 17:31
Show Gist options
  • Save gordonglas/ad72fc5708848e46bf70fe613753337a to your computer and use it in GitHub Desktop.
Save gordonglas/ad72fc5708848e46bf70fe613753337a to your computer and use it in GitHub Desktop.
Windows batch file to backup Pool of Radiance and Gold Box Companion folders
: Backup "Pool of Radiance" and "GBC" (Gold Box Companion) root folders
: to a specified location.
: Requires 7zip.
@echo off
set sevenZipExe=D:\Program Files\7-Zip\7z.exe
set porPath=D:\Program Files (x86)\GOG Galaxy\Games\Pool of Radiance
set gbcPath=D:\Program Files (x86)\GBC
set backupPath=D:\Users\gglas\Downloads\backup
set cwd=%cd%
: get timestamp in YYYYMMDD-HHMMDDSS format
set timestamp=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%-%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
: when %TIME% is less than 10th hour, it will have a leading space.
: replace the space with a zero
set timestamp=%timestamp: =0%
set backupPorPath=%backupPath%\Pool-of-Radiance\%timestamp%
if not exist "%backupPorPath%" mkdir "%backupPorPath%"
cd /D "%porPath%\.."
"%sevenZipExe%" a "%backupPorPath%\Pool of Radiance.7z" ".\Pool of Radiance"
cd /D "%gbcPath%\.."
"%sevenZipExe%" a "%backupPorPath%\GBC.7z" ".\GBC"
cd /D "%cwd%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment