Created
April 27, 2021 13:10
-
-
Save pizycki/b69b08b44c2d0a702891a27fe3f5f8d5 to your computer and use it in GitHub Desktop.
Replace text in many files
This file contains hidden or 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
$rootDir = "C:\Users\pawel\dev\blabla" | |
$majorVersion = "42" | |
Get-ChildItem $rootDir -File -Recurse ` | |
| Where-Object { $_.Name -match ".(csproj|cs|nuspec|config)$" } ` | |
#| % { write $_.FullName } | |
| ForEach-Object { | |
$content = Get-Content -Encoding utf8 $_.FullName | |
$content = $content.Replace("Namespace.VX", "Namespace.V$($majorVersion)") | |
Set-Content -Encoding utf8 $_.FullName $content | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment