How to create a List that counts files in a folder

Hi Experts,

I tried to create a view of folder in a document library which would do a count of files in a folder but it didn't work out, basically I need to list the folders in the library and in one column a count of all files inside the folder and another column with total size of folder (with its files)

It sounds easy even to me but couldn't figure this out

Thanks in advance
SamooramadAsked:
Who is Participating?
 
AlMothanaAlOmariConnect With a Mentor Commented:
ok , this is not out of the box in sharepoint , what you should do  is to write a custom code (web part ) to read form list folders and to retrive the # of files inside each folder
use this links
http://mundeep.wordpress.com/2009/02/24/checking-if-a-spfolder-exists/ 
http://msdn.microsoft.com/en-us/library/dd587263(office.11).aspx 
0
 
AlMothanaAlOmariCommented:
Hi , i didn't get your Question ?  what do you want to do ? if you mean that you want to create a folder in a document library list , and to add items into this folder , do the following
If the list or library is not already open, click its name on the Quick Launch. On the New menu , click New Folder.
sometimes by default "New folder " is disable , to enable it go to list settings -->under Genral settings slsect advance settings
in the advance settings page , folder section select yes in the "Display "New Folder" command on the New menu? "
check the attached image
 

NewFolder.jpg
0
 
SamooramadAuthor Commented:
Hi, sorry for not being clear, I have a document library in SharePoint, it has multiple folders for each Division, say HR, IT , Operation, Finance...etc, each department has a number of files in their respective folders, I would like to have a view (if possible) that will list the root folders (the division folders) and next to the name of the folder have a column which counts the number of files in THAT folder only and its size

Is that clear? so for example:

Folder                   No. of Files                  Size
HR                               43                            2MB
Finance                       12                            6MB

as an example
Thanks
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
SamooramadAuthor Commented:
ok great, that answers my question about how to get the number of files in a folder, but once I get this how can I display them in column or create a view with this information to be displayed to users?
0
 
MsShadowConnect With a Mentor Commented:
Create a list with two columns, title and amount.

Then use this piece of code to add items to the list:
http://msdn.microsoft.com/en-us/library/ms467435.aspx
0
 
SamooramadAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.