vb Delete a file

Sub DeleteFile(strFile)
	Dim strFullPath
	Dim filesystem

	strFullPath = Server.Mappath(strFile)
	Set filesystem = Server.CreateObject("Scripting.FileSystemObject") 
	
	If filesystem.FileExists(strFullPath) Then
		Call filesystem.DeleteFile(strFullPath,true)
		Response.Write "

File " & strFile & " has been deleted!

" Else Response.Write "

File " & strFile & " does not exist!

" End If Set filesystem = nothing End Sub
Deletes a file if it exists.

Updated: Saturday 2nd October 2010, 10:37am

There are 0 comments

Leave a comment of your own

Comments are currently closed.