I want copy whole folder to another folder using Copy-Item.

My source folder c:\base contains some files:

├───base    
│       file1.txt
│       file2.txt

I use the following command:

Copy-Item c:\base c:\target -recurse

if the target folder (c:\target) exists, the command copies source folder exactly as I want:

├───target
│   └───base    
│           file1.txt
│           file2.txt

If the target folder doesn't exist, the command creates target folder (exactly as I want), but now it copies only the content of the source folder (without the base folder):

├───target    
│       file1.txt
│       file2.txt
  • Why does it happen?
  • How can I use this copy command (additional keys?) without create the target folder before?
Edit
Report