-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathren.ps1
More file actions
27 lines (22 loc) · 867 Bytes
/
ren.ps1
File metadata and controls
27 lines (22 loc) · 867 Bytes
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
param ($oldNs, $newNs, $oldV, $newV)
$Utf8Encoding = New-Object System.Text.UTF8Encoding $True
Get-ChildItem * -Include *.cs, *.xaml, *csproj -recurse |
Foreach-Object {
$c = ($_ | Get-Content)
$c = $c -replace $oldNs, $newNs
[IO.File]::WriteAllText($_.FullName, ($c -join "`r`n"), $Utf8Encoding)
}
Get-ChildItem * -Include *.csproj, AssemblyInfo.cs -recurse |
Foreach-Object {
$c = ($_ | Get-Content)
$c = $c -replace $oldV, $newV
[IO.File]::WriteAllText($_.FullName, ($c -join "`r`n"), $Utf8Encoding)
}
Get-ChildItem * -Include *.nuspec -recurse |
Foreach-Object {
$c = ($_ | Get-Content)
$c = $c -replace "$oldV", "$newV"
$c = $c -replace $oldV, $newV
$c = $c -replace $oldNs, $newNs
[IO.File]::WriteAllText($_.FullName, ($c -join "`r`n"), $Utf8Encoding)
}