如何从vb.net中的文件夹读取多个csv文件 [英] how to read multple csv file from a folder in vb.net
本文介绍了如何从vb.net中的文件夹读取多个csv文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从一个名称不同的文件夹中读取多个csv文件,而这些csv位于该文件夹内的其他文件夹中.我想在这些文件夹的不同文件夹中搜索这些csv.所以请帮助我从该文件夹中的其他文件夹读取csv.
i want to read multiple csv files from a folder with different names and these csv''s are inside different folders inside that folder. i want to search thesse csv''s in different folders of that folders. so plz help me to read the csv from different folder inside that folder. tnx in advance.
推荐答案
看看System.IO命名空间中的DirectoryInfo类,它是C#代码,但易于转换!
Have a look at the DirectoryInfo class in the System.IO namespace, C# code but simple to convert!
string directoryPath = @"C:\FolderToSearch";
DirectoryInfo dir = new DirectoryInfo(directoryPath);
FileInfo[] files = dir.GetFiles("*.csv", SearchOption.AllDirectories);
foreach (FileInfo file in files)
{
// However you want to process the CSV file
}
看看: ^ ]-以VB.NET为例.
Take a look at: DirectoryInfo.GetFiles method[^] - with an example in VB.NET.
这篇关于如何从vb.net中的文件夹读取多个csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文