Skip to content

Instantly share code, notes, and snippets.

@ghotz
Created October 10, 2014 17:47
Show Gist options
  • Save ghotz/4091ac29e53eaf553999 to your computer and use it in GitHub Desktop.
Save ghotz/4091ac29e53eaf553999 to your computer and use it in GitHub Desktop.
Replace all files with a given name in subdirectories with another file
$ReplacementFile = "C:\Temp\newfile.txt"
$SearchDir = "c:\Temp\root"
dir $SearchDir -File (Split-Path $ReplacementFile -Leaf) -Recurse |
% { Copy-Item $ReplacementFile $_.FullName -Force}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment