
Deleting Cookies and internet files in VBS
I know I placed something similar before but, the information I receive was
well appreciated but it did not allow me to delete the Temporary Internet
Files and Cookies folder without generating an access violation error. The
Temporary Internet Files and Cookies folders seem to have some special
windows protection. NOTE: I can use this code to delete other directories,
so it does seem to work. below is the sample code That I am playing with.
Can someone please tell me where I am going wrong? I am using win2k Pro:
'This is a test run
'alot of the Echo is to make sure it's doing what it should
'Set WshShell = WScript.CreateObject("WScript.Shell")
'Set WshSpecialFolders = WshShell.SpecialFolders
'For intx = 0 To WshSpecialFolders.Count - 1
' WScript.Echo WshSpecialFolders.Item(intx)&intx
'.Wscript.Echo intx
'Next
'on error resume next
dim fs, fld, f1, fl, s, s1
s1="\ "
s=lcase("c:\documents and settings\administrator\local settings\temporary
Internet
Files\content.ie5\")
's=lcase("c:\documents and settings\administrator\local settings\temporary
Internet
Files\")
's=lcase("c:\documents and settings\administrator\cookies\")
set fs = createobject("Scripting.FileSystemObject")
Set fld = fs.GetFolder(s)
wscript.echo fld
set fl = fld.files
for each f1 in fl
wscript.echo f1
'wscript.echo lcase(s&"index.dat")
if lcase(f1) = lcase(s&"index.dat") then wscript.echo "cannot delete
index.dat"
if lcase(f1) <> lcase(s&"index.dat") and lcase(f1) <> lcase(s&"desktop.ini")
then
fs.DeleteFile(s&"*.*")
'wscript.echo "done"
next
' "c:\documents and settings\"&userid&"\local settings"
' "c:\documents and settings\"&userid&"\cookies"