File count from a folder

前端 未结 10 2406
天命终不由人
天命终不由人 2020-11-27 03:47

How do I get number of Files from a folder using ASP.NET with C#?

10条回答
  •  野性不改
    2020-11-27 03:57

    Try following code to get count of files in the folder

    string strDocPath = Server.MapPath('Enter your path here'); 
    int docCount = Directory.GetFiles(strDocPath, "*", 
    SearchOption.TopDirectoryOnly).Length;
    

提交回复
热议问题