X-Git-Url: https://git.p6c8.net/psmysqlbackup.git/blobdiff_plain/3706148c7945e09e39f265e13f0a40bb08feb56d..1a72611102cac70674f358c0ec2c558172ed873c:/psmysqlbackup.ps1?ds=sidebyside diff --git a/psmysqlbackup.ps1 b/psmysqlbackup.ps1 index 7e870ea..f544cca 100644 --- a/psmysqlbackup.ps1 +++ b/psmysqlbackup.ps1 @@ -91,7 +91,8 @@ if($configDbBackup -and $configDbBackup.count -gt 0) { } } else { - :excludeOuter foreach($rDb in $databases) { + :excludeOuter + foreach($rDb in $databases) { if($rDb -in $configDbExclude) { continue; } @@ -110,7 +111,14 @@ foreach($d in $databasesToBackup) { $databaseBackupDir = Join-Path -Path $configBackupDir -ChildPath $d if(!(Test-Path $databaseBackupDir)) { - New-Item -ItemType directory -Path $databaseBackupDir -ErrorAction Stop | Out-Null + try { + New-Item -ItemType directory -Path "$databaseBackupDir" -ErrorAction Stop | Out-Null + } + catch { + Write-Output "Failed to create directory $databaseBackupDir" + Write-Output $_ + exit 1 + } } $databaseBackupFile = Join-Path -Path $databaseBackupDir -ChildPath "backup-$d-$currDaytime.sql"