6

Without jumping the gun and writing some extravagant Web Services CAML query or PowerShell script (which may be optimal here), I would like to ask if anyone knows how to obtain a list of large files in a given SharePoint 2007 Site Collection.

Our database is huge and we are looking to clean-up the actual site data a bit before shrinking the database. I'm aware of SharePoint having size limitations but I believe we've removed or raised the cap if I'm not mistaken.

1
  • A basic approach might be iterate among all the sites and libraries and get all the files with length higher than 100MB for example. Are you searching for something like this? Commented May 6, 2011 at 15:21

5 Answers 5

5

Anyway, it shouldn't be so hard:). This powershell works fine (SP2010). It's just a starting point. It iterates on all the lists of the site.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint")

$rootSite = New-Object Microsoft.SharePoint.SPSite("http://goaw059:25000/sites/itbic")

$spWeb = $rootSite.OpenWeb();

foreach($list in $spWeb.lists)
{
    $list.getitems() | % { 
        if (($_.filesystemobjecttype) -eq 'File') {
            write-output "$($_.name) --> $($_.File.length)"
            }
     }
}
$rootSite.Dispose()
1
  • I really like this powershell script. Thanks for sharing this. I'll mark it as the answer.
    – pixelbobby
    Commented May 6, 2011 at 16:05
2

A quick way of doing this is to use the WebDAV interface from Windows. Open a document library in Windows Explorer (button on the Documents tab in the ribbon on SP2010 - forgotton where it is on SP2007- in the site actions menu I think). Now you can use the Windows Explorer tools to get the size of a folder, sort by size, filter or search by size, etc., as if it was a folder on your local computer.

The other way is to iterate over your document libraries with PowerShell - but that's not going to work so well with SP2007.

2

If your files are indexed by SharePoint search, you could run an Enterprise Search SQL query against the search webservice (SPSearch.asmx for WSS or Search.asmx for MOSS):

SELECT filename, size, path FROM SCOPE()
WHERE contentclass='STS_ListItem_DocumentLibrary' AND path LIKE 'http://servername/sites/MySiteCollection/%' ORDER BY size DESC
1

Axceler PinPoint can help, it's free and will identify up to 99 items. It's one of those small tools I keep in my toolbox.

1
  • This product is awesome. You are a gentleman and a scholar!
    – pixelbobby
    Commented May 6, 2011 at 15:37
1

Open the top level site collection Open up site settings in the far left column "Site Collection Administration" select "Storage Space Allocation"

Default display is document libraries, and you can sort by the size column. You can also switch to documents to display a list of the largest documents in descending size order.

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.