Features
Ask DevGuru
ASP Resources
Find the Bug
Knowledge Base
Links
Tips of the Week
Tutorials
Products
dgCalendar
dgCharge New!
dgChart New!
dgFileUpload
dgReport New!
dgSort
dgTree
Site
Authoring
Coming Soon
DevGuru Resume
Link to Us
Merchandise
Sponsorships
Testimonials
What's New
Technologies
ADO 2.6
ASP
CSS2
HTML
JavaScript
Jet SQL
Transact-SQL Syntax
VBScript
WML
WMLScript
WSH
XML DOM
All Methods
FileSystemObject Object
METHOD: FileSystemObject.DeleteFile
Implemented in version 2.0
object.
DeleteFile
file [, force]
This method is used to delete a specified file or files (using wildcards). The optional
force
parameter returns a Boolean value -
True
allows files with read-only attributes to be deleted, while
False
(default) does not. Trying to delete a read-only file without setting
force
to
True
will return an error.
Note that an error also occurs if you try to delete a file that doesn't exist.
Code:
<%
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CreateTextFile "c:\somefile.txt", True
If filesys.FileExists("c:\somefile.txt") Then
filesys.DeleteFile "c:\somefile.txt"
Response.Write("File deleted")
End If
%>
Output:
"File deleted"
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information