Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Cannot Delete Files?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,10
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Cannot Delete Files?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Cannot Delete Files? - 5/23/2001 12:53:31 AM   
  drkesrel

 

Posts: 11
Score: 0
Joined: 5/23/2001
From: USA
Status: offline
I have created the following simple VB script file, attempting to automate the deletion of All Cookies and Temporary Internet Files. But the results is that whilst browsing from Window's Explorer, I can't see any cookies files, looking at IE5's Tools->Internet Options->Settings->View Files, I could still see all cookies and temporary files?? What's wrong? How could i delete all files. What's wrong?


Dim fso
Dim folder


Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set folder = fso.getfolder("c:\winnt\profiles\userID\Local Settings\Temporary Internet Files")
delAllFolders(folder)

Set folder = fso.getfolder("c:\winnt\profiles\userID\Cookies")
delAllFolders(folder)

Set folder = fso.getfolder("c:\winnt\Temporary Internet Files")
delAllFolders(folder)




Private Sub delAllFolders(myFolder)
Dim myFolders
Dim eachFolder

Set myFolders = myFolder.SubFolders

delAllFiles(myFolder)
For each eachFolder in myFolders
delAllFolders(eachFolder)
Next

end Sub

Private Sub delAllFiles(myFolder)
Dim myFiles
Dim eachFile
Dim tmp

Set myfiles= myFolder.files

For each eachFile In myFiles

if (eachFile.Name <> "index.dat") and not(eachFile.Attributes and 1) Then
'tmp= myFolder.Name & "--" & eachFile.Name & "-" & eachFile.Attributes
' MsgBox tmp
eachFile.Delete
end if
Next

End Sub
 
 
Post #: 1
 
 Re: Cannot Delete Files? - 5/23/2001 12:54:34 AM   
  subnation

 

Posts: 20
Score: 0
Joined: 5/22/2001
From: USA
Status: offline
Try this.
eachFile.Delete true ' delete even if read only

(in reply to drkesrel)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Cannot Delete Files? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts