Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot delete cookies

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
I have created the following simple VB script file, attempting to automate the deletion of All Cookies. 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. Something wrong with IE??


Code:
Dim fso
Dim folder


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

Set folder = fso.getfolder("c:\winnt\profiles\lamp\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 <> &quot;index.dat&quot;) and not(eachFile.Attributes and 1)  Then
        'tmp= myFolder.Name & &quot;--&quot; & eachFile.Name & &quot;-&quot; &  eachFile.Attributes
       ' MsgBox tmp
        eachFile.Delete
    end if
   Next
   
End Sub
 
How about letting the atuoexec.bat file do it on every startup?
Check out thread608-84123 Cheers,
Jim
iamcan.gif
 
Sorry, but neither the batch file method or the VB script method work.

I use IE5.01 on WinNT 4 Workstation

When I run
Code:
delIECookies.cmd
as follows (NT have a slightly different directory structure for IE, with profiles directory, but I deleted both the &quot;temporary internet files&quot; directory under winnt and profiles anyway):
Code:
c:
del /s /f /q &quot;c:\winnt\profiles\userID\Local Settings\Temporary Internet Files\*.*&quot; 
del /s /f /q &quot;c:\winnt\Temporary Internet Files\*.*&quot; 
del /s /f /q &quot;c:\winnt\profiles\userID\cookies\*.txt&quot;


rd /s /q &quot;c:\winnt\profiles\userID\cookies\&quot;
rd /s /q &quot;c:\winnt\cookies\&quot;

cd c:\winnt
md cookies

cd c:\winnt\profiles\userID
cd c:\winnt
md cookies


I obtained the following output. Nevertheless, if I then open IE5 (start page= blank), select Tools->Internet Options->Settings->View Files, all temporary internet files and cookies are clearly still there!
Code:
C:\WINNT\PROFILES\userID\DESKTOP>del /s /f /q &quot;c:\winnt\profiles\userID\Local Settings\Temporary Internet Files\*.*&quot;
c:\winnt\profiles\userID\Local Settings\Temporary Internet Files\Content.IE5\index.dat
The process cannot access the file because it is being used by another process.
Code:
Deleted file - c:\winnt\profiles\userID\Local Settings\Temporary Internet Files\Content.IE5\6PQRATCV\ACTIVI~1.GIF

C:\WINNT\PROFILES\userID\DESKTOP>del /s /f /q &quot;c:\winnt\Temporary Internet Files\*.*&quot;
Could Not Find *.*

C:\WINNT\PROFILES\userID\DESKTOP>del /s /f /q &quot;c:\winnt\profiles\userID\cookies\*.txt&quot;
Deleted file - c:\winnt\profiles\userID\cookies\USERID~1.TXT

C:\WINNT\PROFILES\userID\DESKTOP>rd /s /q &quot;c:\winnt\profiles\userID\cookies\&quot;
c:\winnt\profiles\userID\cookies\index.dat -
The process cannot access the file because it is being used by another process.
Code:
C:\WINNT\PROFILES\userID\DESKTOP>rd /s /q &quot;c:\winnt\cookies\&quot;

C:\WINNT\PROFILES\userID\DESKTOP>cd c:\winnt

C:\WINNT>md cookies

C:\WINNT>cd c:\winnt\profiles\userID

C:\WINNT\PROFILES\userID>cd c:\winnt

C:\WINNT>md cookies
A subdirectory or file cookies already exists.

C:\WINNT>

I don't know what is wrong, but Any help would be appreciated
 
I tried, but still could not delete the index.dat file un der the cookies directory.

Is this what is causing files to be seen as not deleted from IE->Tools->Internet Options->Settings->View Files ??

In Window's explorer, all files appear to have been deleted, though!

Note that index.dat could not be deleted not due to file permission problem but that even if I try to manually delete index.dat under explorer, I get an error saying there is a sharing violation (file may be in use) even when IE is not started!
 
index.dat is used by the system to &quot;take care&quot; of the cookies on the system.
You still should be able to delete the file under DOS before windows loads.
I think the problem lies with the user profiles/security of NT/Win2k/XP, and you don't really have DOS, just a command prompt.
I know this works under win9x.
I'm going to play on my XP box, and see if I can figure this out for you. Cheers,
Jim
iamcan.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top