I have a folder, which contains sub folders. For example: Doc is the root folder. Inside it has 2 sub folders named Doc1 and Doc2.
Doc1 contains 2 sub folders - fol1 and fol2.
"fol2" folder does not contain any files, where as "foc1" has a file in it. I am trying to get the count of files modified in last 30 days. Against each of the sub folders,and the corresponding parent folder i want to show the count of
modified items. I am getting the sub folders count, but that count is not getting updated to the parent folder.
I am missing a small part of updation, but not sure where it is. This is the code i have used:
public static void GetOpenItems()
SPFolder folder = list.RootFolder;
int mouas = 0;
if (folder != null && folder.Name.CompareTo("Forms") != 0)
//Get Individual Folder Total
foreach (SPFolder subFolder in folder.SubFolders)
if (subFolder.Name.CompareTo("Forms") != 0)
mouas = CountFilesInFolder(subFolder, System.DateTime.Now.AddDays(-30));
subFolder.Item["Files_Count"] = mouas;
static int CountFilesInFolder(SPFolder folder, DateTime startDate)
View Complete Post