当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP DeleteFile 方法
The DeleteFile method deletes one or more specified files.
DeleteFile的作用是删除一个或多个指定的文件
Note: An error will occur if you try to delete a file that doesn't exist.
注意:如果你试图删除一个不存在的文件的话将导致错误产生。
FileSystemObject.DeleteFile(filename[,force]) |
Parameter参数 | Description描述 |
---|---|
filename | Required. The name of the file or files to delete (Wildcards are allowed) 必要组件。设定需要被删除的文件的名称(可以使用通配符) |
force | Optional. A Boolean value that indicates whether read-only files will be deleted. True indicates that the read-only files will be deleted, False indicates that they will not be deleted. Default is False 可选组件。它是一个逻辑值,用于设定是否可以删除只读格式(read-only)的文件。如果值为“true真”,则可以删除;如果是“false假”,则不可以删除。默认时为:false假。 |
<% dim fs Set fs=Server.CreateObject("Scripting.FileSystemObject") fs.CreateTextFile("c:test.txt",True) if fs.FileExists("c:test.txt") then fs.DeleteFile("c:test.txt") end if set fs=nothing %> |