Copy a whole folder tree with Copy-Item -Recurse

The PowerShell built-in for recursive folder copies — most people forget it exists and reach for xcopy or robocopy.

WindowsFilescopypowershellLow risk
Use Copy-Item -Path <source> -Destination <dest> -Recurse to copy a folder and everything inside it.

01Command

Command
$ Copy-Item -Path 'C:\Source\Project' -Destination 'D:\Backup\Project' -Recurse

02What it does

Without -Recurse, Copy-Item copies only the top level, which surprises people expecting cp -r behavior. If the destination folder doesn't exist it is created, and existing files are overwritten only when you add -Force. Wildcards work too: C:\Source\* -Destination D:\Backup -Recurse copies the contents rather than a nested folder.

03Risk

RiskLow risk
RequirementsPowerShell
!Warning: If the destination already contains files, re-running the copy silently overwrites them with -Force — no confirmation prompt.

04Undo

Undo
$ Remove-Item -Path 'D:\Backup\Project' -Recurse -Force

05Sources

  • Copy-Item - PowerShell
    SS64 · technical · 2026-09-17
    Evidence: SS64 lists -Recurse for recursive copy and -Force to overwrite existing destination files.
  • Copy-Item | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents that Copy-Item -Recurse copies the contents of a folder including its subdirectories, and that -Force overwrites read-only items.

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions