File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,22 @@ $excludedItems = @(
48
48
" appsettings.Development.json" , " CreateTemplate.ps1" , " nupkg"
49
49
)
50
50
51
+ # Get absolute path of the output directory to avoid copying it
52
+ $absoluteOutputPath = (Resolve-Path - Path $OutputDirectory ).Path
53
+
51
54
# Get all directories in the source directory except excluded ones
52
55
Get-ChildItem - Path $SourceDirectory - Directory |
53
- Where-Object { $excludedItems -notcontains $_.Name } |
56
+ Where-Object {
57
+ $excludedItems -notcontains $_.Name -and
58
+ # Skip if the current directory is the output directory
59
+ $_.FullName -ne $absoluteOutputPath -and
60
+ # Skip if the current directory is inside the output directory
61
+ -not $_.FullName.StartsWith (" $absoluteOutputPath \" ) -and
62
+ # Skip if the output directory is inside the current directory
63
+ -not $absoluteOutputPath.StartsWith (" $ ( $_.FullName ) \" )
64
+ } |
54
65
ForEach-Object {
66
+ Write-Host " Copying directory: $ ( $_.Name ) "
55
67
Copy-Item - Path $_.FullName - Destination $OutputDirectory - Recurse - Force
56
68
}
57
69
@@ -63,6 +75,7 @@ Get-ChildItem -Path $SourceDirectory -File |
63
75
$_.Extension -ne " .nupkg"
64
76
} |
65
77
ForEach-Object {
78
+ Write-Host " Copying file: $ ( $_.Name ) "
66
79
Copy-Item - Path $_.FullName - Destination $OutputDirectory - Force
67
80
}
68
81
You can’t perform that action at this time.
0 commit comments