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 = @(
4848 " appsettings.Development.json" , " CreateTemplate.ps1" , " nupkg"
4949)
5050
51+ # Get absolute path of the output directory to avoid copying it
52+ $absoluteOutputPath = (Resolve-Path - Path $OutputDirectory ).Path
53+
5154# Get all directories in the source directory except excluded ones
5255Get-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+ } |
5465 ForEach-Object {
66+ Write-Host " Copying directory: $ ( $_.Name ) "
5567 Copy-Item - Path $_.FullName - Destination $OutputDirectory - Recurse - Force
5668 }
5769
@@ -63,6 +75,7 @@ Get-ChildItem -Path $SourceDirectory -File |
6375 $_.Extension -ne " .nupkg"
6476 } |
6577 ForEach-Object {
78+ Write-Host " Copying file: $ ( $_.Name ) "
6679 Copy-Item - Path $_.FullName - Destination $OutputDirectory - Force
6780 }
6881
You can’t perform that action at this time.
0 commit comments