Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $SourceRoot = "Z:\foo"
- $DestRoot = "Z:\bar"
- $SourceContent = Get-ChildItem $SourceRoot -Recurse
- $SourceContent | ForEach-Object {
- If ($_.PSIsContainer) {$NewItemType = "Directory"}
- Else {$NewItemType = "File"}
- $newitem = ($_.fullname).replace($SourceRoot, $DestRoot)
- New-Item -Path $newitem -ItemType $NewItemType -force
- (Get-Item -Path $newitem).LastWriteTime = $_.LastWriteTime
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement