且构网

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

如何使用.dll扫描文件夹中文件名列表中的文件

更新时间:2022-06-07 22:27:48

你所寻求的是 DirectoryInfo 类,您可以使用 EnumerateFiles()方法。



这将允许您do是遍历指定目录中的所有文件。在您浏览它们时,您可以根据列表检查名称,并根据具体情况执行您想要的操作。



MS Docs:DirectoryInfo.EnumerateFiles Method(System.IO)| Microsoft Docs [ ^ ]
What you seek is the DirectoryInfo class, in which you can use the EnumerateFiles() method.

What this will allow you to do is to go through all of the files in a specified directory. While you loop through them, you can check the names against your list and do what you want on a case by case basis.

MS Docs: DirectoryInfo.EnumerateFiles Method (System.IO) | Microsoft Docs[^]