Metode ASP DeleteFile
Metode DeleteFile untuk menghapus satu atau lebih tertentu file.
CATATAN: Jika Anda mencoba untuk menghapus file tidak ada, itu akan meningkatkan kesalahan.
tatabahasa
FileSystemObject.DeleteFile(filename[,force])
参数 | 描述 |
---|---|
filename | 必需的。需删除文件的名称(可使用通配符)。 |
force | 可选的。指示是否可删除只读文件的布尔值。True 指示可删除只读文件,False 指示不可删除只读文件。默认是 False。 |
contoh
<%
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
%>
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
%>
Lengkap Obyek Referensi FileSystemObject