$p4= "C:\Program Files\Perforce\p4.exe"
# need to be changed
$path="C:\dev\www"
$oldValue="((?<=\<td(.*))align\=""right"")"
$newValue="align=""left"""
# need to be changed
Write-Host "Searching for : $oldValue"
Write-Host "Replaced value: $newValue"
$count=0
dir $path -Recurse -Include *.aspx, *.ascx| ForEach-Object{
$text=Get-Content $_.FullName;
if ($text -match $oldValue)
{
&$p4 edit $_.FullName
$text=$text -replace $oldValue,$newValue
set-content $_.FullName -value $text
$count++
}
}
Write-Host "total files found:$count"
Set the correct path of the “$p4” variable to point to the correct Perforce exe.