Create Project Backup BAT file
Oct 17
1 min read
A small utility to make backing up Unreal Engine projects quicker and easier without manually selecting files or folders using 7-zip.
The script automatically detects the current project folder name, adds the current date to the backup filename, and compresses the project into a ZIP archive. It excludes generated folders such as Binaries, Intermediate, and Saved to reduce backup sizes.
It also checks whether 7-Zip is installed and warns you if a backup with the same filename already exists.
@echo off
set "PROJECT_DIR=%~dp0"
set "BACKUP_DIR=%PROJECT_DIR%ProjectBackups"
set "SEVENZIP=C:\Program Files\7-Zip\7z.exe"
:: Change this to your project's name if you want to hard set it.
::set "PROJECT_NAME=MyProject"
:: Get the project folder name
for %%A in ("%~dp0.") do set "PROJECT_NAME=%%~nxA"
:: Check that 7-Zip exists
if not exist "%SEVENZIP%" (
echo 7-Zip was not found.
echo Please download and install 7-Zip from:
echo https://www.7-zip.org/
pause
exit /b 1
)
:: Create backup directory if it doesn't exist
if not exist "%BACKUP_DIR%" mkdir "%BACKUP_DIR%"
:: Create date in DD-MM-YYYY format
for /f %%A in ('powershell -NoProfile -Command "Get-Date -Format dd-MM-yyyy"') do set "DATE=%%A"
set "BACKUP_FILE=%BACKUP_DIR%\%PROJECT_NAME%_%DATE%.7z"
:: Check whether today's backup already exists
if exist "%BACKUP_FILE%" (
echo.
echo Backup already exists:
echo %BACKUP_FILE%
echo.
pause
exit /b 1
)
:: Create backup
echo Creating backup...
echo.
"%SEVENZIP%" a -t7z "%BACKUP_FILE%" ^
"%PROJECT_DIR%Config" ^
"%PROJECT_DIR%Content" ^
"%PROJECT_DIR%Plugins" ^
"%PROJECT_DIR%Source" ^
"%PROJECT_DIR%*.uproject"
if %ERRORLEVEL% EQU 0 (
echo.
echo Backup complete:
echo %BACKUP_FILE%
) else (
echo.
echo Backup failed.
)
pause
Comments