$path = "C:\xxxx"
$pathnew = $path + "\new"
If(!(test-path $pathnew))
{
New-Item -ItemType Directory -Force -Path $pathnew
}
[System.Collections.ArrayList]$Files = @(Get-ChildItem $path -Filter *.json |
Where-Object {$_.PSIsContainer -eq $false} |
Select-Object FullName,Name)
foreach ($File in $Files) {
[System.Collections.ArrayList]$File_Contents = @(Get-Content $File.FullName)
$FN = $File.FullName
$OutPutFile = $pathnew + "\" + $File.Name
$txt = Get-Content $FN
$txt2 = Get-Content $FN | Measure-Object -Line
$txtLess3 = $txt2.Lines-3
$txt[6..12],"`"submission`": {",$txt[1..3]
," `"performanceYear`": 2019},"
,$txt[13..$txtLess3] | Out-File $OutPutFile
}