From 287c55d464928c2ff2ff3ce09240dec427b85ec7 Mon Sep 17 00:00:00 2001 From: Patrick Veilleux Date: Wed, 7 Feb 2024 17:25:35 -0500 Subject: [PATCH] include files with no extensions --- functions/server/Backup-Server.psm1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/functions/server/Backup-Server.psm1 b/functions/server/Backup-Server.psm1 index 86b0aa0..66d29ee 100644 --- a/functions/server/Backup-Server.psm1 +++ b/functions/server/Backup-Server.psm1 @@ -37,11 +37,13 @@ try { Write-ServerMsg "File: $($_.FullName) Extension: $($_.Extension)" } + # If the file is a directory, include it in the backup if ($_.PSIsContainer) { if($Global.Debug) {Write-ServerMsg "Is a Folder"} return $true } + # If the file extension is in the global exclusions list, exclude it from the backup if ($Global.Exclusions.Count -gt 0) { if ($_.Extension -in $Global.Exclusions) { if($Global.Debug) {Write-ServerMsg "Excluded: Global Extension Exclusions"} @@ -49,12 +51,15 @@ try { } } + # If the filename match the backups Regex Exclusions, exclude it from the backup if ($Backups.Exclusions -ne "") { if ($_.Name -match $Backups.Exclusions) { if($Global.Debug) {Write-ServerMsg "Excluded: REGEX"} return $false } } + + # else include it in the backup if ($Global.Debug) {Write-ServerMsg "Included"} return $true }