0

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 Answer 1

0

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.