1. This method is used to get the size of folder in SharePoint
private static long GetFolderSize(SPFolder folder)
{
long folderSize = 0;
foreach (SPFile file in folder.Files)
{
folderSize += file.Length;
}
foreach (SPFolder subfolder in folder.SubFolders)
{
folderSize += GetFolderSize(subfolder);
}
return folderSize;
}
2. This method is used to Get Number Of Files In Folder in SharePoint
private static int GetNumberOfFilesInFolder(SPFolder folder)
{
int folderNum = 0;
foreach (SPFile file in folder.Files)
{
folderNum += 1;
}
foreach (SPFolder subfolder in folder.SubFolders)
{
folderNum += GetNumberOfFilesInFolder(subfolder);
}
return folderNum;
}
{
int folderNum = 0;
foreach (SPFile file in folder.Files)
{
folderNum += 1;
}
foreach (SPFolder subfolder in folder.SubFolders)
{
folderNum += GetNumberOfFilesInFolder(subfolder);
}
return folderNum;
}