How to Find Large Files in SharePoint Online? Effortlessly
SharePoint document management is very crucial to optimize the SharePoint performance. Most of the SharePoint users tasks get delayed because of the slow performance of SharePoint. Although there are several ways to maximize the SharePoint performance. But the major one is the large files that occupy most of the space. So, in this article, we will discuss how to find large files in SharePoint Online.
Here you will find the different methods to search SharePoint Online large files in detail. So, let’s get started.
Why is it Necessary to Know Large Files in SharePoint?
There are several reasons due to which you should be aware of the storage occupied by the large files in SharePoint.
1. Performance Optimization
Users interact with SharePoint on a daily basis to upload, download, or sync files. But SharePoint’s busyness in processing the large files gets delayed. So, to optimize the SharePoint performance, it is required to know the large files.
2. Storage Management
Your subscription decided the storage of the SharePoint and how much data you can store in it. Therefore, to allocate the storage for the large files in such a way that it doesn’t affect the essential storage.
3. Migration Planning
When performing SharePoint tenant to tenant migration, it requires to know the large files to plan the migration accordingly.
4. Backup Efficiency
Large files in SharePoint Online can complex the backup process. Determining the large files and prioritize them for the backup can accomplish the process efficiently.
How to Find Large Files in SharePoint Online?
You can go the Admin Center and check the files that are extremely affecting the SharePoint site performance.
Step 1. Open SharePoint Online site collection to search large files.
Step 2. Click on the Settings option and then hit the Site Settings.
Step 3. In the Site settings section, navigate to the Storage Metrics.
Step 4. Take a look at the storage metrics of the SharePoint site
Step 5. Identify the individual storage of files and folders to examine their storage usage.
Alternatively, you can also find the large files basis on the size of the files. It can be accomplished by using the size property, which is an inbuilt option in the SharePoint. For instance, you can execute queries like.
- Size > 9000000, extract all the files greater than 9 MB.
- Size > 500000 AND filetype:xlsx, it returns all the Excel files of size greater than 5 MB.
You can manipulate queries to know the maximum file size in SharePoint Online
How to Search For Large Files in SharePoint Online Using PowerShell?
Use the below commands to find large files in SharePoint Online sites. But do not forget to make sure that you are using the latest SharePoint Online management shell.
$SharePoint_Site_URL = "enter URL" $FilePathCSV = "C:\Temp\LargeFiles.csv" Connect-PnPOnline -Url $SharePoint_Site_URL -Credentials (Get-Credential) $File_Data = @() $Document_SP_Libraries = Get-PnPList | Where-Object {$_.BaseType -eq "DocumentLibrary" -and $_.Hidden -eq $False} ForEach ($List in $Document_SP_Libraries) { Write-host " Library is Processing:"$List.Title -f Yellow $AllFiles = Get-PnPListItem -List $List -PageSize 500 | Where {($_.FieldValues.FileLeafRef -like "*.*") -and ($_.FieldValues.SMTotalFileStreamSize/1MB -gt 100)} #Collect data from each files ForEach ($File in $AllFiles) { $File_Data += [PSCustomObject][ordered]@{ Library = $List.Title FileName = $File.FieldValues.FileLeafRef URL = $File.FieldValues.FileRef CreatedBy = $File.FieldValues.Author.Email Created = $File.FieldValues.Created ModifiedBy = $File.FieldValues.Editor.Email Modified = $File.FieldValues.Modified Size = [math]::Round(($File.FieldValues.SMTotalFileStreamSize/1MB),2) }}} $File_Data | Sort-object Size -Descending $File_Data | Export-Csv -Path $FilePathCSV -NoTypeInformation
How to Find All Large Files of Your SharePoint Online Tenant?
If you want to find large files in SharePoint Online tenant then execute the below commands.
$URL_Tenant_SP_Admin = "enter URL" $FilePathinCSV = "C:\Temp\LargeFiles.csv" Connect-PnPOnline -Url $URL_Tenant_SP_Admin -Interactive if (Test-Path $FilePathinCSV) { Remove-Item $FilePathinCSV } $Site_Collections = Get-PnPTenantSite | Where { $_.URL -like '*/sites*' -and $_.Template -NotIn ("SRCHCEN#0", "REDIRECTSITE#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "EDISC#0", "STS#-1")} $Excluded_All_Lists = @("Form Templates", "Preservation Hold Library","Site Assets", "Pages", "Site Pages", "Images", "Site Collection Documents", "Site Collection Images","Style Library") $Site_Count = 1 ForEach($Site in $Site_Collections) { Write-Progress -id 1 -Activity "Processing Site Collections" -Status "Processing Site: $($Site.URL)' ($Site_Count of $($Site_Collections.Count))" -PercentComplete (($Site_Count / $Site_Collections.Count) * 100) Connect-PnPOnline -Url $Site.URL -Interactive $SP_Doc_Libraries = Get-PnPList | Where-Object {$_.BaseType -eq "DocumentLibrary" -and $_.Hidden -eq $False -and $_.Title -notin $Excluded_All_Lists -and $_.ItemCount -gt 0} $List_Count = 1 ForEach ($List in $SP_Doc_Libraries) { $global:counter = 0 $FileData = @() Write-Progress -id 2 -ParentId 1 -Activity "Processing Document Libraries" -Status "Processing Document Library: $($List.Title)' ($List_Count of $($SP_Doc_Libraries.Count))" -PercentComplete (($List_Count / $SP_Doc_Libraries.Count) * 100) $Files = Get-PnPListItem -List $List -Fields FileLeafRef,FileRef,SMTotalFileStreamSize -PageSize 500 -ScriptBlock { Param($items) $global:counter += $items.Count; Write-Progress -Id 3 -parentId 2 -PercentComplete ($global:Counter / ($List.ItemCount) * 100) -Activity "Getting List Items of '$($List.Title)'" -Status "Processing Items $global:Counter to $($List.ItemCount)";} | Where {($_.FileSystemObjectType -eq "File") -and ($_.FieldValues.SMTotalFileStreamSize/1MB -gt 100)} ForEach ($File in $Files) { $FileData += [PSCustomObject][ordered]@{ Library = $List.Title FileName = $File.FieldValues.FileLeafRef URL = $File.FieldValues.FileRef Size = [math]::Round(($File.FieldValues.SMTotalFileStreamSize/1MB),2) } } $FileData | Sort-object Size -Descending $FileData | Export-Csv -Path $FilePathinCSV -NoTypeInformation -Append $List_Count++ } $Site_Count++ }
Conclusion
In this write-up, we have discussed the different methods to find large files in SharePoint Online. You can use the PowerShell or admin center method as per your expertise. Now, you can analyse the occupied storage of the large files and plan your next decision to optimize SharePoint performance.