3 Replies - 867 Views - Last Post: 31 March 2017 - 01:15 PM

#1 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Copy An Entire Folder Via Powershell Copy-Item

Posted 23 March 2017 - 03:09 PM

Ello gov'na(s),
So I'm trying to use PS to copy an entire folder but it only copies the folder itself.

I was on the MSDN and their answers are always way too complicated for my liking.

Can anyone give me a quick syntax for copying an entire folder using powershell?

I use

Copy-Item \\xxx.xxx.xxx.xxx\xxxx\MyFolderIwantCopied\ \\xxxxxxx-xx\c$\move

it only copies the folder, not the contents

:dozingoff:

Is This A Good Question/Topic? 0
  • +

Replies To: Copy An Entire Folder Via Powershell Copy-Item

#2 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Copy An Entire Folder Via Powershell Copy-Item

Posted 23 March 2017 - 03:21 PM

-Recurse
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6340
  • View blog
  • Posts: 25,572
  • Joined: 12-December 12

Re: Copy An Entire Folder Via Powershell Copy-Item

Posted 23 March 2017 - 03:27 PM

From MSDN it appears you need a star:

Quote

Want to copy all the items in C:\Scripts (including subfolders) to C:\Test? Then simply use a wildcard character, like so:

Copy-Item c:\scripts\* c:\test

You can either first create the new folder if it doesn't exist, or explore the recurse option mentioned further down.
Was This Post Helpful? 1
  • +
  • -

#4 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Copy An Entire Folder Via Powershell Copy-Item

Posted 31 March 2017 - 01:15 PM

Interesting!! Just saw this, thanks for the response I'll try that. -Recurse seems to work but you can never have too many parameters :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1