更新时间:2022-12-22 11:23:56
string dirPath = @C:\; //你的文件目录路径
string filter =*。*; //如果你想要任何特定的类型在这里给它。例如:* .txt
string [] files = Directory.GetFiles(dirPath,filter);
foreach(文件中的字符串文件)
{
//读取文件并在DB中保存内容的逻辑
}
string dirPath = @"C:\"; // your directory path for files
string filter = "*.*"; // if you want any specific type give it here. ex: *.txt
string[] files = Directory.GetFiles(dirPath, filter);
foreach (string file in files)
{
// logic to read file and save content in DB
}