Robocopy Root Folder


  1. Posts : 1
    10
       #1

    Robocopy Root Folder


    I am trying to set up robocopy for work to be able to move profiles during our upcoming deployment, but I am running into issues with getting it to move the root folder. What I am using right now is:

    robocopy "H:\Desktop\Test" "C:\Users\j_f\OneDrive" /e /S /J /move

    It is running just fine to move everything inside the Test folder, but it does not move the actual Test folder itself. I'm not sure if there is an option that I am missing that would cover this.

    I realize that I could just change the source to one step above the Test folder, but I don't want to move the entire Desktop folder and all of its contents.

    Any help with this would be greatly appreciated.
      My Computer


  2. Posts : 4,187
    Windows 11 Pro, 22H2
       #2

    Welcome to TenForums!

    That is expected behavior. You can resolve this by adding a line to make the Test folder and then modify your line to move the contents of the folder to the Test folder.

    MD "C:\Users\j_f\OneDrive\Test"
    robocopy "H:\Desktop\Test" "C:\Users\j_f\OneDrive\Test" /e /S /J /move


    Edit:

    My apologies, I just realized that you can do this on a single line since robocopy will create folders for you. Just use this:

    robocopy "H:\Desktop\Test" "C:\Users\j_f\OneDrive\Test" /e /S /J /move

    This cause it to create the Test folder, move the contents of the original test folder to it, then delete the original (including the folder).
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:54.
Find Us




Windows 10 Forums