Powershell Copy-Item recursively but don't include folder name

Your command is telling PowerShell to copy the folder itself, with all its contents, to the destination folder. To copy only the contents of the original folder, change your path as follows:

Copy-Item -Path "C:\FolderA\*" -Destination "C:\FolderB\" -recurse -Force -Verbose

Notice the asterisk (*) after the folder name. This will copy the content (including subfolders) of the folder, but not the folder itself to the destination folder.

Using the Copy-Item Cmdlet


You can use -File -Recurse for Copy only Files Recursively:

Copy-Item -Path "C:\Source" -Destination "C:\Dest" -File -recurse -Force -Verbose

Or use -Directory -Recurse to copy only empy folder structure:

Copy-Item -Path "C:\Source" -Destination "C:\Dest" -Directory -recurse -Force -Verbose

Kind Regards,

Paul Pedroza