VB .NET: how to use wildcards to delete files in batch mode?

Posted by NosaLee in .NET Programming on 27-07-2012. Tags: , , , , , , , ,

Author: Nosa Lee
Original Address: http://www.seeksunslowly.com/vb-net-how-to-use-wildcards-to-delete-files-in-batch-mode
To reprint this article, please indicate the source, thank you.
_____________________________________

 

In the programming work, we usually need to use wildcards to delete files in batch mode.

For .NET, it is very easy, does not need to do a circulation in a directory.

Just need to use Kill method!

Sample Code (VB 2008):

Microsoft.VisualBasic.FileSystem.Kill("E:\test\*.jpg")

For C#, you can also use kill to delete files in batch mode with wildcards, but please note that you need to using Microsoft.VisualBasic namespace.

Post a comment