.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to get folder or File or Drive size

Posted By: kamlesh     Posted Date: July 04, 2011    Points:5   Category :C#
how to get Folder or drive size in c# on check event of treeview node

Responses
Author: Amit Mehra             
Posted Date: July 04, 2011     Points: 20   

Hi you can use this code to get the folder size

 int GetSize(Directory)
{
int Size = 0;

foreach ( File in Directory )
{
FileInfo fInfo of File;
Size += fInfo.Size;
}

foreach ( SubDirectory in Directory )
{
Size += GetSize(SubDirectory);
}
return Size;
}


ref - http://stackoverflow.com/questions/1118568/how-do-i-get-a-directory-size-files-in-the-directory-in-c

to get the file size you can use File class to get the file size

hope this helps

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Gowthammanju             
Posted Date: July 05, 2011     Points: 20   

try these link as


http://www.dotnetspark.com/Forum/2729-how-to-search-filefolder-using-c-sharp.aspx

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Narayanan             
Posted Date: July 18, 2011     Points: 20   

Hi,
Check this Link
http://www.dotnetspider.com/resources/28501-Search-File-Directory.aspx

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend