我在文件夹中有许多文件具有相同的名称但扩展名不同。我想删除名称为abc
的所有文件,无论其扩展名如何。如何在VB.NET中完成?
答案 0 :(得分:3)
试试这个:
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