Question Delete All *.tmp files on D:

stefshuuj

New member
Joined
Feb 10, 2012
Messages
1
Programming Experience
Beginner
Hi All,

Beginner here trying to write his first vb.net program. Any help would be greatly appreciated.

I want to be able to delete all *.tmp files within all sub folders of my D:\

I am using the command:

Try
Kill("D:\*.tmp")

Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "No tmp files found !!")

End Try

Ideally what I would like is: Delete all D:\*.tmp files, then have a message box giving the total number deleted or a message saying no temp files found if that's the case.

Thanks in advance for any pointers.
Cheers
Stephen
 
Your going to have to build your own recursive file search and delete each file individually. There are lots of examples of a recursive file search on line so a simple search will find you what you need.
 
Back
Top