Skip to content

Instantly share code, notes, and snippets.

@thecliguy
Created October 29, 2018 10:18
Show Gist options
  • Save thecliguy/6babc7084d42b11af16e574b53f8ec9b to your computer and use it in GitHub Desktop.
Save thecliguy/6babc7084d42b11af16e574b53f8ec9b to your computer and use it in GitHub Desktop.
$SourceRoot = "C:\foo"
$DestRoot = "C:\blah"
$SourceContent = Get-ChildItem $SourceRoot -Recurse
$SourceContent | foreach {
If ($_.PSIsContainer) {$NewItemType = "Directory"}
Else {$NewItemType = "File"}
$newitem = ($_.fullname).replace($SourceRoot, $DestRoot)
New-Item $newitem -ItemType $NewItemType -force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment