0
votes

I'm needing to copy the subfolders to another location.

  • Folder1
  • -subfolder1
  • -subfolder2
  • Folder2

and need it like...

  • Folder1
  • -subfolder1
  • -subfolder2

I've used this script ... Copy-Item -LiteralPath '\ipaddress\Exports' -Destination '\ipaddress\Exports2' -Recurse -Filter {PSIsContainer -eq $true}

I was hoping to get the subfolders but instead I get the main folder with subfolders underneath...

  • Folder1
    • -subfolder1
    • -subfolder2
  • Folder2
    • Folder1
    • -subfolder1
    • -subfolder2
1

1 Answers

0
votes

If you also want to include files directly under Folder1:

Copy-Item .\Folder1\* -Recurse -Destination .\Folder2\

If not:

Get-ChildItem -Directory .\Folder1\ | Copy-Item -Destination .\Folder2\ -Recurse