can we copy directly the folder? RRS feed

  • Question

  • Hi Guys,

    I'm quite new to scripting, my question is, can we access the following path AppData\Local\Microsoft\OneDrive\settings and make a copy of the content in settings? As far as I understand you can copy-item but can we copy directly the folder?

    Thanks in advance.

    • Split by jrv Wednesday, August 22, 2018 6:28 PM New question
    Wednesday, August 22, 2018 3:17 PM

All replies

  • help Copy-Item -online


    Wednesday, August 22, 2018 7:15 PM
  • Hi,

    Thanks for your question.

    As jrv's said, you can use copy-item to copy the folder.

    If you want to copy the entire contents of all subfolders below this folder, you can use recurse parameter. 

    Follow the example below:

    Copy-Item -path C:\test -Destination c:\test2\ -Recurse

    Best  Regards,


    Just do it.

    Thursday, August 23, 2018 2:00 AM
  • To dispatch a myth.  When using any copy utility to copy a folder all subitems are always copied.   "Recurse" is never required and hasn't been since the first version of DOS.


    Thursday, August 23, 2018 2:13 AM
  • Hi jrv,

    Thanks for your reply.

    Following are the screenshots of trying two commands:

    Can you help me answer the reasons why these two commands return different results?

    Please sir.

    Best Regards,


    Just do it.

    Thursday, August 23, 2018 2:33 AM
  • Remove the extra "\" from the target or add it to the first path only.  This is the behavior of the COPY API.


    Thursday, August 23, 2018 2:45 AM
  • Hi jrv,

    I have tried these two ways. But the output is also copy a empty folder.

    But only when I add the -recurse  parameter, it can copy the full folder content.

    Please tell me the reason. I'm really confused about it.

    Best Regards,


    Just do it.

    Thursday, August 23, 2018 2:54 AM
  • If you want to skip empty folders use RoboCopy.


    Thursday, August 23, 2018 3:51 AM