I have a file structure similar to:
OldLocation/A, OldLocation/B, OldLocation/C, and OldLocation/D
I want to move folders A, B, and D to NewLocation (along with their contents). I have the following code:
$Copyfiles = Get-ChildItem -Path $folder -Directory -Exclude 'C'
foreach ($item in $Copyfiles)
{
Copy-Item -Path $item -Recurse -Force -Destination $Dest
}
My desired goal is to end up with NewLocation/A/A's stuff, NewLocation/B/B's stuff, NewLocation/D/D's stuff
It seems to almost work, the only hang up is for some reason it only copies the contents of folder A, and not the folder itself. Thus I get NewLoacation/A's stuff, NewLocation/B/B's stuff, and NewLocation/D/D's stuff
How can I fix this?