Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setlocal
- REM Set the path to the folder you want to compress
- set "folder=E:\MainProject"
- REM Set the destination folder for the compressed file
- set "destination=E:\Backups"
- REM Set the new destination folder to copy the compressed file
- set "newDestination=Y:\Unity Stuff\Backups"
- REM Get the current date and time in the format YYYY-MM-DD-HH-MM
- for /f "tokens=1-6 delims=/: " %%a in ("%date% %time%") do (
- set "datestamp=%%a-%%b-%%c-%%d-%%e-%%f"
- )
- REM Remove leading zeros from minute
- set "minute=%datestamp:~-2%"
- if "%minute:~0,1%"=="0" set "minute=%minute:~1%"
- REM Change the current working directory to the destination folder
- cd /d "%destination%"
- REM Compress the folder using 7zip with maximum compression
- 7z a -t7z -m0=lzma2 -mx9 -mfb=64 -md=32m -ms=on "MainProject_%datestamp%.7z" "%folder%"
- REM Open the destination folder in Windows Explorer
- explorer "%destination%"
- REM Copy the compressed file to the new destination folder
- copy "MainProject_%datestamp%.7z" "%newDestination%"
- endlocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement