I want to migrate files from local drives to SharePoint Online. Copying files with the Windows Explorer changes the file dates, which I want to keep. My goal is to create a Batch file which helps the user to migrate the files to the cloud. The process needs to be as simple as possible for the enduser.

Robocopy does a good job by mirroring a complete folder BUT I can't connect it to SharePoint.

First I stumbled upon this thread here. When trying to map or access the SharePoint directory the CMD prompt wants me to add the SharePoint to the trusted sites.

Then I found this script here BUT when I run it none of the commands is recognized nor do they work.

My current code is this:

ROBOCOPY "C:\Users\XYZ1234\OneDrive\DEMO_SharePoint" "C:\Users\XYZ1234\Company\TestSharePoint - Dokumente\Robocopy Test" /COPY:DATO /MIR

This copies the files to the synced SharePoint folder on my computer (and keeps the created date) but when they are uploaded the created date/time is equal to the copy date/time.

Now I'm stuck. Any ideas from the community?

1 Answer 1


Unfortunately, this is undoable, as Sharepoint's files metadata is populated when it is uploaded such as the (Creator, File Created Date, and Last Modified Date).

  • When I use robocopy the Last modified date is carried over to SharePoint. :-|
    – Der_Fab
    Commented May 26, 2021 at 10:17
  • Yes, that is because "Last Modified Date" is referring to the "Last Modified Date" in Sharepoint, not on the local computer, I suggest not wasting anymore time pondering on this small issue as it will not affect anything else, if I helped, do mark my answer as the acceptable answer, thanks! Commented May 26, 2021 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.