Click here to Skip to main content
15,902,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone....

I want to show sum of size of sub folder of any folder

My code is
C#
MessageBox.Show( ( System.IO.Directory.GetDirectories(Sdada).Sum(filess => Directory.GetDirectories(Sdada ).Length).ToString() ) );  

Here i got how many folder is in the main folder but i want to show total size of
of main folder .

how can i do that ?

Thank You
Posted
Updated 13-Sep-12 19:43pm
v2
Comments
Sandeep Mewara 14-Sep-12 1:43am    
You mark it as ASP.NET and use MessageBox! :doh:

1 solution

Hi,

use this code:
C#
MessageBox.Show(Directory.GetFiles(Sdada, "*", SearchOption.AllDirectories).Sum(x => (double)(new FileInfo(x).Length)).ToString());
 
Share this answer
 
Comments
krushna chandra jena 14-Sep-12 2:29am    
Thank you..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900