Recently, in the course of a CRM on-premise to online migration, we were also asked to help move SharePoint online as well. There are several third-party tools that do a good job of this, but one thing we had a problem with was the fact that some of the files and folders in SharePoint had been created outside of the Document Library structure, and these apps were unable to access those documents.

While searching for a way to make this work, I came across a neat trick using good-old Robocopy to duplicate the files. Below are the steps to complete this process.

Navigate to the Proper Document Library

1. In SharePoint, using Internet Explorer, navigate to the document library you want to duplicate. Then, in the “Classic” ribbon, click the option to “Open in Windows Explorer”.

Map Network Drive

2. Copy the directory path in the Explorer window. Then, you can map this location as a network drive by navigating to “This PC” and clicking “Map network drive” in the ribbon. Naming your drives S: for source and T: for target may help you keep the SharePoint locations straight. You should probably uncheck “Reconnect at sign-in.”

Run Robocopy

3. After you’ve mapped the source and target locations, you can run Robocopy from the command line. The simplest command is:

robocopy S:\foldername T:\foldername

You have lots of other options using robocopy. For example, add /MIR to the command to create a mirror image of the directory.

When the copy is complete, you’ll see a nice report of all the files that were transferred. This simple procedure will help the process of moving SharePoint online much easier.