I want copy whole folder to another folder using Copy-Item
.
My source folder c:ase
contains some files:
├───base
│ file1.txt
│ file2.txt
I use the following command:
Copy-Item c:ase c:arget -recurse
if the target folder (c:arget
) 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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…