Skip to content

Instantly share code, notes, and snippets.

@stefanwalther
Created December 30, 2014 20:43
Show Gist options
  • Save stefanwalther/81ce696d0a8dac05dfa9 to your computer and use it in GitHub Desktop.
Save stefanwalther/81ce696d0a8dac05dfa9 to your computer and use it in GitHub Desktop.
Powershell to backup all local MongoDB databases
$date = Get-Date -UFormat %Y-%m-%d;
$backupFolder = $date;
$basePath = "C:\bla";
$destinationPath = Join-Path $basePath $backupFolder;
if(!(Test-Path -Path $destinationPath)) {
New-Item -ItemType directory -Path $destinationPath;
(C:\mongodb\bin\mongodump.exe --out $destinationPath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment