0

Hi i have some number of files in a document library and i want sum of all file sizes using powershell or any other way i can get the total file size?

i have a site collections and i get total size of documents based on document creation date in between last two months like march to april

1
  • Not a simple question... Do you want to include size of document versions? Content of lists? Pages? Content in the Recycle Bin? Commented May 20, 2018 at 18:07

1 Answer 1

1

For an approximate total content size for a Site Collection using PowerShell:

Get-SPSite http://yourServer/sites/yourSite | select StorageUsed

The same from REST API:

http://yourServer/sites/yourSite/_api/site/usage

Count and size for a single library (excluding versions):

Get-SPSite http://yourServer/sites/yourSite | 
  select -ExpandProperty lists | 
  where Title -eq "Documents" | 
  select -ExpandProperty Items | 
  select -ExpandProperty File | 
  measure -Property Length -Sum

Count and size of files for an entire Site Collection (excluding versions, list content, and "other"):

Get-SPSite http://yourServer/sites/yourSite | 
  Get-SPWeb -Limit all | 
  select -ExpandProperty lists | 
  select -ExpandProperty Items | 
  select -ExpandProperty File | 
  measure -Property Length -Sum
3
  • Hi Mike, i want to check size only for documents in doc libraries, and how i use above query ?
    – adilahmed
    Commented May 20, 2018 at 19:26
  • Are you asking how to use PowerShell? Commented May 20, 2018 at 19:56
  • yes how i use above query , and i required total size based on doc creation in between lat two monts
    – adilahmed
    Commented May 20, 2018 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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