How to get the folder data size from SPO site to plan the migration so we can phase out the migration and run the migration via third-party tool?

Mytoast Admin 285 Reputation points
2024-05-20T16:44:41.0166667+00:00

How to get the folder data size from SPO site to plan the migration so we can phase out the migration and run the migration via third-party tool?

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2024-05-21T02:48:10.24+00:00

    Hi @Mytoast Admin ,

    Thank you for posting in this community.

    Here are steps to get the folder data size:

    1. Navigate to the site >> Click on Settings gear >> Site Settings >> Click on the “Storage Metrics” link under “Site Collection Administration” (URL Shortcut: /_layouts/15/storman.aspx).
    2. On the storage metrics page, click on the document library to navigate to the location where the target folder is stored.

    User's image

    The storage metrics page provides valuable insights into the size of each folder and file name (including version history size).


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


  2. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2024-05-21T06:41:35.1933333+00:00

    Hi @Mytoast Admin ,

    Using the following powershell to export the sizes of all folders in a document library:

    Remember to replace the variable $SiteURL$ListName, $CSVFile with your own.

    #Parameters
    $SiteURL = "https://yourdomain.sharepoint.com/sites/yoursite"
    $ListName = "Branding"
    $CSVFile = "C:\Temp\FolderSize.csv"
     
    Try {
        #Connect to PnP Online
        Connect-PnPOnline -Url $SiteURL -Interactive
         
        #Get all folders from the document library
        $Folders = Get-PnPListItem -List $ListName -PageSize 2000 | Where { $_.FileSystemObjectType -eq "Folder" }
         
        #Calculate Folder Size from files
        $FolderSizeData = @()
        $Folders | ForEach-Object {
            #Extract Folder Size data
            $FolderSizeData += New-Object PSObject -Property  ([Ordered]@{
                "Folder Name"  = $_.FieldValues.FileLeafRef
                "URL" = $_.FieldValues.FileRef       
                "Size" = $_.FieldValues.SMTotalSize.LookupId
            })
        }
        $FolderSizeData | Format-Table
        $FolderSizeData | Export-csv $CSVFile -NoTypeInformation
        #Calculate the Total Size of Folders
        $FolderSize = [Math]::Round((($FolderSizeData | Measure-Object -Property "Size" -Sum | Select-Object -expand Sum)/1KB),2)
        Write-host -f Green ("Total Size: {0}" -f $FolderSize)
    }
    Catch {
        Write-Host -f Red "Error:"$_.Exception.Message
    } 
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.