Skip to content

Commit

Permalink
Update Get-DbaFile.ps1 (#9202)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7FFFFFFFFFFFFFFF authored Jan 24, 2024
1 parent b27370e commit 3d0b877
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion public/Get-DbaFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,14 @@ function Get-DbaFile {
foreach ($type in $FileTypeComparison) {
if ($row.filename.ToLowerInvariant().EndsWith(".$type")) {
$fullpath = $row.fullpath.Replace("\", $separator)

# Replacing all instances of '\\' with single backslashes '\', and maintain the leading SMB share path represented by the initial '\\'.
$is_smb_share_path = $fullpath.SubString(0, 2) -eq "\\"
$fullpath = $fullpath.Replace("\\", "\")
if ($is_smb_share_path) {
$fullpath = $fullpath -replace "^\\", "\\"
}

$fullpath = $fullpath.Replace("//", "/")
[PSCustomObject]@{
ComputerName = $server.ComputerName
Expand Down Expand Up @@ -220,4 +227,4 @@ function Get-DbaFile {
}
}
}
}
}

0 comments on commit 3d0b877

Please sign in to comment.