Last active
April 21, 2024 21:11
-
-
Save baywet/bcbed5e52c59f4201e7c to your computer and use it in GitHub Desktop.
small powershell script which allows you to quickly clean your repo during the migration
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
param([string]$targetPath) | |
$targetSearchPath = $targetPath+"\*" | |
remove-item $targetSearchPath -Recurse -include *.vspscc,*.vssscc -Verbose | |
$slnRegexPattern = 'GlobalSection\(TeamFoundationVersionControl\)[:\w\d\s\\.=\/{}-]*EndGlobalSection' | |
$slnFiles = get-childitem -Path $targetSearchPath -Recurse -Filter *.sln | |
foreach($slnFile in $slnFiles) | |
{ | |
$content = get-content $slnFile.FullName -Raw | |
if($content -match $slnRegexPattern) | |
{ | |
($content -replace $slnRegexPattern, '') | Out-File -FilePath $slnFile.FullName -Verbose -Encoding utf8; | |
} | |
} | |
$projRegexPattern = '[\t\r]*<Scc.*</Scc\w*>' | |
$projFiles = get-childitem -Path $targetSearchPath -Recurse -Filter *.*proj | |
foreach($projFile in $projFiles) | |
{ | |
$content = Get-Content $projFile.FullName -Raw | |
if($content -match $projRegexPattern) | |
{ | |
($content -replace $projRegexPattern, '') | Out-File -FilePath $projFile.FullName -Verbose -Encoding utf8; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment