Using Powershell I have to get the total size of all attached files on all list items for a generic list. I tryed to use the function below but this will display the total length of names for the attached files.
function GetListSize($List, $Web)
{
[long]$listSize = 0
foreach ($listItem in $List.Items)
{
$listItemAttachments = $listItem.Attachments
foreach($file in $listItemAttachments)
{
$listSize += $file.Length
}
}
$totalInMb = ($listSize/1024)/1024
$totalInMb = "{0:N2}" -f $totalInMb
return $totalInMb
}
I can do this using c# (http://mykiavash.wordpress.com/2011/05/02/how-to-get-size-of-sharepoint-2010-list-item-attachment/) code but no ideea using PowerShell script. Do you have any ideea ?
ok, omlin helped me to solve this. pls see :
https://sharepoint.stackexchange.com/questions/12652/get-total-size-of-attached-files-on-all-list-items-in-sharepoint-2007with-powersh
To check the size using the interface this is nice : http://msmvps.com/blogs/shane/archive/2008/06/20/list-size-reporting.aspx