-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-MergedVcf.ps1
37 lines (32 loc) · 1.15 KB
/
Get-MergedVcf.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[CmdletBinding()]
param (
[Parameter()]
[string]
$SourcePath,
[Parameter()]
[string]
$DestinationPath,
[Parameter()]
[string[]]
$Exclude = @()
)
if (Test-Path -Path $DestinationPath) {
Write-Host -NoNewline -ForegroundColor DarkYellow "Destination Path "
Write-Host -NoNewline -ForegroundColor Cyan "$DestinationPath"
Write-Host -ForegroundColor DarkYellow " does exist already, please remove file or provide different file name"
} else {
$amountFilesRead = 0
Get-ChildItem -Filter "*.vcf" -Path $SourcePath |
ForEach-Object {
if ($_.Name -notin $Exclude) {
$fullFileName = $_.FullName
$currentVcfContent = Get-Content -Path $fullFileName
$currentVcfContent | Out-File -Append -Encoding utf8NoBOM -FilePath $DestinationPath
$amountFilesRead++
}
}
Write-Host -NoNewline -ForegroundColor DarkYellow "Wrote "
Write-Host -NoNewline -ForegroundColor Cyan "$amountFilesRead"
Write-Host -NoNewline -ForegroundColor DarkYellow " contact files to "
Write-Host -ForegroundColor Cyan "$DestinationPath"
}