Skip to content

Instantly share code, notes, and snippets.

@spy86
Created October 28, 2019 21:21
Show Gist options
  • Select an option

  • Save spy86/03efcb4fd1e44dc31f74a45280c1b0c6 to your computer and use it in GitHub Desktop.

Select an option

Save spy86/03efcb4fd1e44dc31f74a45280c1b0c6 to your computer and use it in GitHub Desktop.
$date = Get-Date -UFormat %Y-%m-%d;
$backupFolder = $date;
$basePath = "F:\mongodb_backup";
$destinationPath = Join-Path $basePath $backupFolder;
if(!(Test-Path -Path $destinationPath)) {
New-Item -ItemType directory -Path $destinationPath;
(C:\mongodump.exe --out $destinationPath);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment