删除所有同名但任意扩展名的文件

Abh*_*ish -1 vb.net

我的文件夹中有许多具有相同名称但扩展名不同的文件。我想删除所有名称为 的文件abc,无论其扩展名如何。在 VB.NET 中如何做到这一点?

小智 5

尝试这个 :

Dim sourceDir as String = "here type full path to directory"
'loop trough list of file(s) and delete it
For Each fullPathFile As String In System.IO.Directory.GetFiles(sourceDir, "abc.*")
   System.IO.File.Delete(fullPathFile)
Next
Run Code Online (Sandbox Code Playgroud)