Duplicated folders after migration SharePoint Migration Tools

Joven Pinca 21 Reputation points
2021-05-25T03:33:01.923+00:00

Hello,

I have migrated some files and folders from a windows server to SharePoint online site using SharePoint Migration Tool. When I go to site>documents to check, I saw the migrated files, but I have noticed that there are duplicate folder which is also the primary folder I just moved. I cannot just delete it because I don't know which one has complete files.

Also, does it really creates another folder with the name same with the site name then that is where the migrate files were being stored? Some of the migrated files on other site the data was just stored under Documents not like on a Folder with same site name under Documents.

I'd like to know what is the cause of multiple file duplication after it migrates to target site also how to get the size of each folder aside from total storage consumption on Active Sites of admin page, it will help me to identify which folder should I delete.

Hope someone can answer my questions above.

Thanks,

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,131 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,759 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CaseyYang-MSFT 10,391 Reputation points
    2021-05-25T10:08:28.237+00:00

    Hi anonymous userenPinca-1646

    Per my test, I didn’t find out why SharePoint Migration Tool creates multiple duplicated folders. But you can check folder size in Storage Metrics.

    Please follow the steps below:
    Site Information > View all site settings > Site Collection Administration > Storage Metrics
    99434-1.png

    And you can use PowerShell to check folder size.
    PowerShell codes:

    #Function to Get the size of a Folder in SharePoint Online  
    Function Get-SPOFolderSize([Microsoft.SharePoint.Client.Folder]$Folder)  
    {   
         Try  
         {  
            #Get all Files and Subfolders from the folder  
            $Ctx.Load($Folder.Files)  
            $Ctx.Load($Folder.Folders)  
            $Ctx.ExecuteQuery()  
      
            $FolderSize = 0  
            ForEach($File in $Folder.Files | Where {-Not($_.Name.EndsWith(".aspx"))})  
            {  
                #Get File versions  
                $Ctx.Load($File.Versions)  
                $Ctx.ExecuteQuery()  
                $VersionSize=0  
                If($File.Versions.Count -ge 1)  
                {  
                    #Calculate Version Size  
                    $VersionSize = $File.Versions | Measure-Object -Property Size -Sum | Select-Object -expand Sum                                  
                }  
                $FileSize =  [Math]::Round((($File.Length) + $VersionSize)/1KB, 2)  
                If($FileSize -gt 0)  
                {  
                    Write-host "`tSize of the File '$($File.Name)' "$FileSize  
                }  
      
                #Get File Size  
                $FolderSize += $FileSize  
            }  
      
            If($FolderSize -gt 0)  
            {  
                Write-host -f Yellow "Total Size of the Folder '$($Folder.ServerRelativeUrl)' (KB): " -NoNewline  
                $FolderSize= [Math]::Round($FolderSize/1KB, 2)  
                Write-host $FolderSize  
            }  
            #Process all Sub Folders  
            ForEach($Folder in $Folder.Folders | Where {-Not($_.Name.StartsWith("_") -or $_.Name -eq "Forms")})  
            {  
                #Call the function recursively  
                Get-SPOFolderSize $Folder  
            }  
        }  
        Catch [System.Exception]  
        {  
            Write-Host -f Red "Error:"$_.Exception.Message  
        }  
    }  
         
    #parameters  
    $SiteURL = "https://tenant-admin.sharepoint.com/"  
      
    #Get credentials to connect to SharePoint Online Admin Center  
    $Cred = Get-Credential  
         
    #Set up the context  
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)  
    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)  
           
    #Get the Web  
    $Web = $Ctx.Web  
    $RootFolder = $Web.RootFolder  
    $Ctx.Load($RootFolder)  
    $Ctx.ExecuteQuery()  
        
    #Call the function to get Subsite size  
    Get-SPOFolderSize -Folder $RootFolder  
    

    For Reference:
    https://www.sharepointdiary.com/2018/06/sharepoint-online-get-folder-size-using-powershell.html
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.