且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过MVC应用程序扫描文件。

更新时间: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
}