更新时间:2022-06-07 22:27:48
你所寻求的是DirectoryInfo
类,您可以使用 EnumerateFiles()方法。
这将允许您do是遍历指定目录中的所有文件。在您浏览它们时,您可以根据列表检查名称,并根据具体情况执行您想要的操作。
MS Docs:DirectoryInfo.EnumerateFiles Method(System.IO)| Microsoft Docs [ ^ ]
What you seek is theDirectoryInfo
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[^]