Question

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.

Was it helpful?

Solution

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()

OTHER TIPS

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.

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

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top