Skip to content

Instantly share code, notes, and snippets.

@blacktambourine
Created August 10, 2015 07:42
Show Gist options
  • Save blacktambourine/5ba28545a856c171ce09 to your computer and use it in GitHub Desktop.
Save blacktambourine/5ba28545a856c171ce09 to your computer and use it in GitHub Desktop.
Backup a Windows based Mongo DB
@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 Mongo DB Backup Complete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment