Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Encode files UTF-8
$dir = "target directory"
Get-ChildItem $dir -Recurse -Include *.cs | Rename-Item -NewName {$_.FullName + ".bkup"}
Get-ChildItem $dir -Recurse -Include *.cs.bkup | ForEach-Object {Get-Content $_.FullName | Out-File -Encoding UTF8 ($_.FullName -replace '.bkup','')}
Get-ChildItem $dir -Recurse -Include *.cs.bkup | del
Get-ChildItem $dir -Recurse -Include *.cshtml | Rename-Item -NewName {$_.FullName + ".bkup"}
Get-ChildItem $dir -Recurse -Include *.cshtml.bkup | ForEach-Object {Get-Content $_.FullName | Out-File -Encoding UTF8 ($_.FullName -replace '.bkup','')}
Get-ChildItem $dir -Recurse -Include *.cshtml.bkup | del
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment