本博客还有大量的.NET开源技术文章,您可能感兴趣:
5..NET平台机器学习组件-Infer.NET系列文章:链接
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
Code/// <summary> /// 获取指定文件夹下所有的文件名称 /// </summary> /// <param name="folderName">指定文件夹名称,绝对路径</param> /// <param name="fileFilter">文件类型过滤,根据文件后缀名,如:*,*.txt,*.xls</param> /// <param name="isContainSubFolder">是否包含子文件夹</param> /// <returns>ArrayList数组,为所有需要的文件路径名称</returns> public static ArrayList GetAllFilesByFolder(string folderName, string fileFilter,bool isContainSubFolder) { ArrayList resArray = new ArrayList (); string[] files = Directory.GetFiles(folderName, fileFilter); for (int i = 0; i < files.Length ; i++) { resArray.Add(files[i]); } if (isContainSubFolder) { string[] folders = Directory.GetDirectories(folderName); for (int j = 0; j < folders.Length; j++) { //遍历所有文件夹 ArrayList temp = GetAllFilesByFolder(folders[j], fileFilter, isContainSubFolder); resArray.AddRange(temp); } } return resArray; } /// <summary> /// 获取指定文件夹下所有的文件名称,不过滤文件类型 /// </summary> /// <param name="folderName">指定文件夹名称,绝对路径</param> /// <param name="isContainSubFolder">是否包含子文件夹</param> /// <returns>ArrayList数组,为所有需要的文件路径名称</returns> public static ArrayList GetAllFilesByFolder(string folderName, bool isContainSubFolder) { return GetAllFilesByFolder(folderName, "*", isContainSubFolder); }
编程爱好者,关注.NET软件开发,Matlab混合编程及网络技术
欢迎光临我的Cnblog博客:http://www.cnblogs.com/asxinyu/
欢迎大家进行交流,QQ :1287263703
E-mail:asxinyu@qq.com,asxinyu@126.com
Tag标签: Matlab,Matlab开发,Matlab混合编程,C#.NET开发