user6015403
user6015403

Reputation:

copy-item powershell issue

This may be a very ridiculous question but when executing the copy-item command, only the main folder is copied MINUS the contents within. for example I have

\server1\parent\child <<---this folder has items nested within but copy-item only moves the folder, not the items within. I have tried the following 2:

copy-item "\\server1\parent\child -destination "\\server2\parent\child

copy-item "\\server1\parent\child\* -destination "\\server2\parent\child

but again, the first line only moves the folder and the second lines moves folder and items but items are not moved within the folder. I was wanting to keep the folder structure the same as from where I am copying it from. I looked at a few places, including here, and I must be missing something.

Any help would be awesome!

Upvotes: 0

Views: 864

Answers (1)

user6015403
user6015403

Reputation:

I found the answer right after I posted the question. I was missing the -recurse option after the \server1\parent\child. The line that now works is

copy-item ''\\Server1\parent\child" -recurse -destination "\\Server1\parent\child"

Thanks Everyone!

Upvotes: 0

Related Questions