Created
January 10, 2017 09:12
-
-
Save bitbonk/7771cef5d32b2c9b267d059469b97676 to your computer and use it in GitHub Desktop.
deploy something but exclude some stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Copies the files that belong to a deployment to a target folder. | |
.PARAMETER Source | |
The path of the source folder. | |
.PARAMETER Target | |
The path of the target folder. | |
#> | |
[CmdletBinding(SupportsShouldProcess=$True)] | |
Param( | |
[Parameter(Mandatory=$True, Position=1, HelpMessage="The path of the source folder")] | |
[string] $Source, | |
[Parameter(Mandatory=$True, Position=2, HelpMessage="The path of the target folder")] | |
[string] $Target | |
) | |
$Source = Convert-Path $Source | |
$Target = Convert-Path $Target | |
Get-Childitem $Source -Recurse | | |
Where-Object { $_.fullname -notmatch "System.Windows.Interactivity.resources.dll|fluentassertions|\.dll\.config$|(System32|System64)\\(Debug|Release)\\(es|fr|hu|it|ja|ko|pt-br|ro|ru|sv|zh-Hans|zh-Hant)$"} | | |
ForEach-Object { | |
if($_.PSIsContainer -eq $false) | |
{ | |
$targetFile = Join-Path $Target $_.FullName.SubString($Source.Length) | |
New-Item (Split-Path -Path $targetFile) -Force -ItemType Directory | |
Copy-Item -LiteralPath $_.FullName -Destination $targetFile -Force -Verbose:($PSBoundParameters['Verbose'] -eq $true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment