Skip to content

Instantly share code, notes, and snippets.

@michal-ciechan
Created January 11, 2022 03:06
Show Gist options
  • Save michal-ciechan/45012eea2950159fd1405c12a9faf6c0 to your computer and use it in GitHub Desktop.
Save michal-ciechan/45012eea2950159fd1405c12a9faf6c0 to your computer and use it in GitHub Desktop.
Replace File Contents + Names + Folder Names
$old = "AngularDemo"
$new = "NewProjectName"
Get-ChildItem -Filter "old" - Recursive | Rename-Item -NewName { $.name -replace $old, $new }
$filesTypesToSearch = @(".cs", ".sln", ".csproj", ".config", "*.json")
Get-ChildItem -Include $filesTypesToSearch -Recurse |
ForEach-Object { $a = $.FullName; ( Get-Content $a ) |
ForEach-Object { $_ -replace $old, $new } |
Set-Content $a }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment