ASP DeleteFile Method
❮ อ้างอิงวัตถุ FileSystemObject ที่สมบูรณ์
วิธีการ DeleteFile จะลบไฟล์ที่ระบุตั้งแต่หนึ่งไฟล์ขึ้นไป
หมายเหตุ:ข้อผิดพลาดจะเกิดขึ้นหากคุณพยายามลบไฟล์ที่ไม่มีอยู่
ไวยากรณ์
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 |
ตัวอย่าง
<%
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
%>
❮ อ้างอิงวัตถุ FileSystemObject ที่สมบูรณ์