I've different two SharePoint Online Site collections with document libraries. I need to compare the source and destination libraries and copy the missed files alone from source to destination.

I know we can do this by third party tool like Share Gate. Is there any other way like using power shell script to automate this process? Please suggest.

Please note that I've content in library with nested folder structure.


There are other 3rd party tools (browser-based) that can report on content in a document library and save the details as a csv file. e.g. Path Name Size ContentTypeId ModifiedDate ModifiedBy Id Type UniqueId MajorVersionCount MajorVersionSize MinorVersionCount MinorVersionSize Encrypted https://slimapplications.sharepoint.com/Customers Customers 37 folders and 24 documents c7d6cb08-c7fe-4ed0-ab0d-850af6ad723d 2020-08-30T22:47:34 c7d6cb08-c7fe-4ed0-ab0d-850af6ad723d 101 4a699888-9397-476d-94aa-f151464977b1

Simply get an inventory for both libraries and use a diff tool to list the differences.

You should also be able to do the same using PowerShell: make an inventory for each library and then use a diff tool to list the differences.


  • Hi Paul, thanks for your reply. My requirement is not to list the differences. I need to compare the source and destination libraries, and copy the files which are not migrated from source library. – taruki_MS Sep 2 '20 at 6:24
  • Hi tarun, clear. I did not understand / read the question properly. Can you use the modify date of items in the source to find items that have changed? or do you also need to cater for deleted items in the source? – Paul Sep 2 '20 at 6:30
  • I just need to check each and every file of the source library present in destination library, if not then i need to copy the missed files alone. – taruki_MS Sep 2 '20 at 6:39
  • Requirements are clear. One possible approach is to use OneDrive for Business (ODFB). Use ODFB to download all documents from the source library to your computer. Also sync the target location with OFDB. Then use robocopy+task scheduler on your local computer to copy all changes in the local source file location to the local target file location. ODFB will then automatically sync all local modified content to the target SharePoint location. It also depends on the number of items in the libraries and whether such a "ad-hoc" approach is robust enough. The main benefit is the costs: none. Paul – Paul Sep 2 '20 at 11:29
  • That will work but as local copies of the content are made and saved to laptop, I'll run out of storage .. I have to unsync and then delete the local copies to continue, a messy process. I think better approach is to automate this using power-shell script? Any help on that? – taruki_MS Sep 2 '20 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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