Skip to content

Instantly share code, notes, and snippets.

@CaptainJiNX
Created June 1, 2012 09:58
Show Gist options
  • Select an option

  • Save CaptainJiNX/2850888 to your computer and use it in GitHub Desktop.

Select an option

Save CaptainJiNX/2850888 to your computer and use it in GitHub Desktop.
Copy a VS project folder to an *Old folder, and rename files and content
$original = 'TeamJinx'
$copyTo = $original + 'Old'
# Copy all files...
ROBOCOPY $original\ $copyTo\ /MIR
# Rename all files containing original name
Get-ChildItem .\$copyTo -Recurse -Include *$original*.* | % { Rename-Item $_.FullName $_.Name.Replace($original, $copyTo) }
# Replace text (i.e. namespaces, classes and file references)
Get-ChildItem .\$copyTo -Recurse -Include *.cs,*.csproj | % {
(Get-Content $_.FullName) | % { $_ -replace $original, $copyTo } | Set-Content -path $_.FullName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment