Robocopy - Folder not moved

Edwald Neo 51 Reputation points
2022-07-23T07:15:14.583+00:00

Dear All,
I have mapped my OneDrive to my partition drive E. I would like to move files / folders that is outside of the mapped OneDrive into the Mapped OneDrive as per diagram below :
223983-image.png

I tried using the following robocopy command but the file was successfully move except the folder. The command is as follows :

" robocopy E:\ "E:\OneDrive - i-Sprint Innovations Pte Ltd" /XD /MOVE "

Please kindly assist to advise what was wrong.

Thanks

Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2022-07-23T07:54:46.367+00:00

    Hi @Edwald Neo ,

    the error message "Error 32 (0x00000020)" shows up because "the process cannot access the file because it is being used by another process".
    If a file or folder is in use by another process it's not possible to delete the file/folder.

    The solution might be to figure out which process is using the file/folder.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

  2. MotoX80 36,291 Reputation points
    2022-07-23T16:42:11.433+00:00

    robocopy E:\ "E:\OneDrive - i-Sprint Innovations Pte Ltd" /XD /MOVE "

    That command should move the files in the root of E to the Onedrive folder. But be aware that if you add the /E switch to also copy subfolders, then you would be trying to move the E drive to itself. The source parameter "E:\" also includes the destination folder, so you are trying to move "E:\OneDrive - i-Sprint Innovations Pte Ltd" to "E:\OneDrive - i-Sprint Innovations Pte Ltd\OneDrive - i-Sprint Innovations Pte Ltd". I don't think that will work.

    You have a /XD switch, but you did not specify any directories to exclude. That would be where you put the OneDrive folder name.

    From "robocopy /?".... /XD dirs [dirs]... :: eXclude Directories matching given names/paths.

    Use the /l switch to list what robocopy would do without actually moving any files. Do that first and review the report.

    Why don't you just use the Windows Explorer to select the directories and do a cut+paste? Do a few folders at a time and verify that that your folders are where you want them.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.