Skip to content

Commit 0148b66

Browse files
authoredMay 4, 2022
Merge pull request #190 from lowlydba/patch-5
New-DcnClone: don't strip trailing slash from root dirs
2 parents 66daecd + 0b57d8e commit 0148b66

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎functions/clone/New-DcnClone.ps1

+6-4
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,12 @@
274274
}
275275
}
276276

277-
# Remove the last "\" from the path it would mess up the mount of the VHD
278-
if ($Destination.EndsWith("\")) {
279-
$Destination = $Destination.Substring(0, $Destination.Length - 1)
280-
}
277+
# If not root dir, remove the last "\" from the path, else it would mess up the mount of the VHD
278+
if (($Destination | Select-String "\\" -AllMatches).Matches.Count -gt 1) {
279+
if ($Destination.EndsWith("\")) {
280+
$Destination = $Destination.Substring(0, $Destination.Length - 1)
281+
}
282+
}
281283

282284
# Test if the destination can be reached
283285
# Check if computer is local

0 commit comments

Comments
 (0)