We can do this simply with PnPOnline, and I am using the web login switch here so we can use our normal login with MFA here.Ī t the end of the article I will show the complete script. Create the target path (the original location)īefore we can do anything we need to connect to the SharePoint site.Finding the duplicate files and folders.I have broken down the script in a couple of steps, each translated to there own function: So we need to work recursively through all the folders, looking for items with (1) in the name. The duplicate folders are not only at the root level of the document library but can also be 3 levels deep in a subfolder. Merging the duplicate folders and files will take a couple of steps. As you can see in this case, the files can be restored, but having a backup solution would make restoring so much easier. I have written before about it Do you need a backup solution for Microsoft 365. This is one of those situations where a third-party backup solution would really be a lifesaver. Microsoft was unable to assist with the cleanup, so I stepped in. Only due to a communication error, the restore job was done in two parts, resulting in duplicate files. Because of the large number of files that were deleted (over the 750.000), they asked Microsoft to restore it, which they did. In case you are wondering what happened An user deleted files locally without stopping the syncing first. So this made it really easy to find the files and folders and merge them with the original location. Users had already worked in the duplicate folders, so we not only needed to merge the folders but also preserve the last modified file.Īll duplicate files or folders had the same pattern, (1), in their file name. A reader of this blog reached out to me if I knew a way to merge duplicate folders in SharePoint Online.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |