Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using kill to delete a file

Status
Not open for further replies.

w1nn3r

ISP
Sep 12, 2001
179
US
I'm using kill to delete files but I've got a large list of files I'm going to kill(delete) but some may not be there but I want to suppress the error that the file isnt there, or better yet if there was a way to check if (file.exe exists) { kill C:\Path\to\file.exe }

Does anyone have any suggestions for this?
 
Use the Dir statement first
Code:
If Len(Dir("C:\Path\to\file.exe")) > 0 Then
Kill ("C:\Path\to\file.exe")
End If

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top