How to Count the Number of Files in a folder May 16, 2015July 13, 2015 by visitor How would I go about getting the number of files in a folder using ASP.NET with C#? Jack from Germantown
Hi Jack There is a build in function in ASP.net that allows you to access the directory information that you can use to get the file count for the folder. The following is a sample code that you can use: System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("SourcePath"); int count = dir.GetFiles().Length;
Hi Jack
There is a build in function in ASP.net that allows you to access the directory information that you can use to get the file count for the folder.
The following is a sample code that you can use:
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("SourcePath");
int count = dir.GetFiles().Length;