Current location: Hot Scripts Forums » General Web Coding » JavaScript » i know how to delete a file! but how to delete a directory?


i know how to delete a file! but how to delete a directory?

Reply
  #1 (permalink)  
Old 08-24-03, 09:51 AM
forcer forcer is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
i know how to delete a file! but how to delete a directory?

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.
Reply With Quote
  #2 (permalink)  
Old 08-24-03, 10:01 AM
greeny greeny is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
<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
__________________
thanks,
valen@efusian.co.uk

Last edited by greeny; 08-24-03 at 10:04 AM.
Reply With Quote
  #3 (permalink)  
Old 08-24-03, 10:07 AM
forcer forcer is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally posted by greeny
Code:
<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

yeh i'm a 'n00b lol
Reply With Quote
  #4 (permalink)  
Old 01-28-04, 07:00 AM
macstonesstorm macstonesstorm is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Help me

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>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Web Host, New Problem! justchat PHP 2 09-29-03 02:39 PM
Upload to user-defined directory? tom PHP 1 09-26-03 11:14 AM
Script for picking the first HTML file out of a directory (with sorted HTML files) jelteveld Script Requests 0 08-16-03 01:30 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM
Question with chown - Change file owner ! Help pls kevin PHP 2 07-09-03 04:36 AM


All times are GMT -5. The time now is 10:43 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.