-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive_proj.bat
27 lines (19 loc) · 1.16 KB
/
archive_proj.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@echo off
setlocal enabledelayedexpansion
set "TempDir=TempProjectArchive"
for %%I in ("%~dp0.") do set "ProjectDir=%%~fI"
for %%A in ("%ProjectDir%") do set "ProjectName=%%~nxA"
if not exist "%ProjectDir%\%TempDir%" mkdir "%ProjectDir%\%TempDir%"
xcopy "%ProjectDir%\Content" "%ProjectDir%\%TempDir%\Content\" /E /I /Q
if exist "%ProjectDir%\Source" xcopy "%ProjectDir%\Source" "%ProjectDir%\%TempDir%\Source\" /E /I /Q
xcopy "%ProjectDir%\Config" "%ProjectDir%\%TempDir%\Config\" /E /I /Q
if exist "%ProjectDir%\.git" xcopy "%ProjectDir%\.git" "%ProjectDir%\%TempDir%\.git\" /E /I /H /Q
if exist "%ProjectDir%\.gitignore" copy "%ProjectDir%\.gitignore" "%ProjectDir%\%TempDir%\" >nul
copy "%ProjectDir%\*.uproject" "%ProjectDir%\%TempDir%\" >nul
for /f "tokens=2 delims==" %%I in ('wmic OS Get localdatetime /value') do set "currenttime=%%I"
set "ZipFile=%ProjectDir%\%ProjectName%_%currenttime:~4,2%_%currenttime:~6,2%_%currenttime:~0,4%_%currenttime:~8,2%_%currenttime:~10,2%_%currenttime:~12,2%.zip"
cd "%ProjectDir%\%TempDir%"
"C:\Program Files\7-Zip\7z.exe" a -tzip "%ZipFile%" * -r
cd "%ProjectDir%"
echo Project archived to: %ZipFile%
rd /s /q "%ProjectDir%\%TempDir%"