Skip to content

Commit

Permalink
include files with no extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
patrix87 committed Feb 7, 2024
1 parent 4256145 commit 287c55d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions functions/server/Backup-Server.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,29 @@ 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"}
return $false
}
}

# 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
}
Expand Down

0 comments on commit 287c55d

Please sign in to comment.