Created
September 19, 2017 02:11
-
-
Save blacktambourine/2217d9bc7ddc727ff4df0d1b7f67a8ad to your computer and use it in GitHub Desktop.
mongo backup with 7zip to compress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do ( | |
set dow=%%i | |
set month=%%j | |
set day=%%k | |
set year=%%l | |
) | |
set datestr=%month%_%day%_%year% | |
echo datestr is %datestr% | |
C:\mongodb\bin\mongodump --out C:\MongoDBBackup\%datestr% | |
echo Compress with 7zip | |
"C:\program files\7-zip\7z.exe" a -mx9 -t7z C:\MongoDBBackup\%datestr%.7z C:\MongoDBBackup\%datestr% | |
echo cleanup | |
rd /S /Q C:\MongoDBBackup\%datestr% | |
echo Mongo DB Backup Complete. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment