Skip to content

Instantly share code, notes, and snippets.

@jtheisen
Last active November 23, 2018 15:57
Show Gist options
  • Save jtheisen/3d40629a4d180b870da2a282e364dacd to your computer and use it in GitHub Desktop.
Save jtheisen/3d40629a4d180b870da2a282e364dacd to your computer and use it in GitHub Desktop.
Get-ChildItem -Recurse -Include bin,obj |? { $_.FullName -inotmatch 'node_modules' } | foreach { Remove-Item -Recurse $_ }
Param(
[Parameter(Mandatory=$True,Position=1)] [string]$Path,
[Parameter(Mandatory=$True,Position=2)] [string]$OldName,
[Parameter(Mandatory=$True,Position=3)] [string]$NewName
)
Get-ChildItem $Path -Filter "*$OldName*" -Exclude ".*" -Recurse | Rename-Item -NewName { $_.name -replace $OldName, $NewName }
Get-ChildItem $Path -Include *.cs, *.csproj, *.nuspec, *.sln -Exclude ".*" -Recurse | ForEach { (Get-Content $_ | ForEach {$_ -replace $OldName, $NewName}) | Set-Content $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment