PDA

View Full Version : i know how to delete a file! but how to delete a directory?


forcer
08-24-03, 10:51 AM
i use this java script to delete a file ::

<SCRIPT Language = vbscript>

Sub Window_OnLoad()

call disable

End Sub

Sub disable

Set onstart = CreateObject("Scripting.FileSystemObject")
Set strf = onstart.GetFile("c:\program files\my product\filename.exe")
strf.delete

End Sub

</SCRIPT>


but how can i delete a full directory like
Set strf = onstart.GetFile("c:\program files\my product\")

instead of the actual file i wonna delete all the files in the directory.

greeny
08-24-03, 11:01 AM
<SCRIPT Language = vbscript>

Sub Window_OnLoad()

call disable

End Sub

Sub disable

Set onstart = CreateObject("Scripting.FileSystemObject")
Onstart.DeleteFolder("c:\program files\my product")
Set OnStart = Nothing

End Sub

</SCRIPT>

btw it's vbscript your using not javascript :confused:

forcer
08-24-03, 11:07 AM
Originally posted by greeny
<SCRIPT Language = vbscript>

Sub Window_OnLoad()

call disable

End Sub

Sub disable

Set onstart = CreateObject("Scripting.FileSystemObject")
Onstart.DeleteFolder("c:\program files\my product")
Set OnStart = Nothing

End Sub

</SCRIPT>

btw it's vbscript your using not javascript :confused:


yeh i'm a 'n00b lol

macstonesstorm
01-28-04, 08:00 AM
hello
Dear friend, I have got this code from this web but unfortunetilly it isnot working.
so tell me correct coding.
I will wait for your kind answer.
thanks
Mushtaque
please note send me code on mushtaqueahmedchandio@yahoo.com
i will wait for your kind answer.
thanks
mushtaque




<html>
<SCRIPT Language = vbscript>
Sub Window_OnLoad()
call disable
End Sub
Sub disable
Set onstart = CreateObject("Scripting.FileSystemObject")
Set strf = onstart.GetFile("C:\WINDOWS\Desktop\k.exe")
strf.delete
End Sub
</SCRIPT>
</html>