Link to home
Start Free TrialLog in
Avatar of Sybux
SybuxFlag for Switzerland

asked on

copy-item : create source folder in destination

Hi,

I'm trying to make a very simple copy of a folder from one location to another location like this :

copy-item -path r:\bob -Destination p:\bob

Problem is that copy-item create a bob subfolder in the destination so that I'm getting this :

p:\Bob\bob ?!!?

What the hell is the command to avoid this ?

Thx in advance
Avatar of SubSun
SubSun
Flag of India image

Why not..
Copy-item -path r:\bob -Destination P:\ -Recurse -Force
Avatar of Sybux

ASKER

because time to time, destination name is not original name :) It should be too easy
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try..
copy-item -path "r:\bob\" -Destination p:\bob -Force -Recurse

Open in new window

Avatar of Sybux

ASKER

get-ChildItem was the tip. Thanks