@echo off
setlocal
rem Set the source directory
set "sourceDir=C:\Users\cat\AppData\Roaming\io.github.clash-verge-rev.clash-verge-rev"
rem Set the 7-Zip executable path
set "sevenZip=C:\Program Files\7-Zip\7z.exe"
rem Check if 7-Zip exists
if not exist "%sevenZip%" (
echo 7-Zip not found at "%sevenZip%". Please install 7-Zip or update the path in the script.
pause
exit /b
)
rem Get current date in YYYYMMDD format
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "dateStamp=%dt:~0,8%"
rem Set the output archive name with date
set "archiveName=ClashVerge_setting_%dateStamp%.7z"
rem Change to the source directory
cd /d "%sourceDir%"
rem Compress the profiles directory and specified files
"%sevenZip%" a -t7z "%~dp0%archiveName%" "profiles\*" "*.json" "*.yaml" -mx9
rem Check if the compression was successful
if %ERRORLEVEL% == 0 (
echo Compression successful! Archive created: %~dp0%archiveName%
) else (
echo Compression failed. Please check if 7-Zip is installed and the paths are correct.
)
pause
endlocal