fso object in Visual Basic

Discussion in 'OT Technology' started by eric_stlouis, Jul 30, 2004.

  1. eric_stlouis

    eric_stlouis New Member

    Joined:
    Oct 10, 2003
    Messages:
    147
    Likes Received:
    0
    Hello all:

    I'm trying to delete the files in my temporary internet files folder with the fso object.

    The problem is that these files are some sort of "cache" files, and fso can't see them.

    I'm using this code:

    Dim fso, f1, f, fc
    Set fso = CreateObject("Scripting.FileSystemObject")
    Path = "C:\Documents and Settings\fredereh\Local Settings\Temporary Internet Files"
    Set f = fso.GetFolder(Path)
    Set fc = f.Files
    For Each f1 In fc
    MsgBox f1.Name
    Next

    All this produces is the desktop.ini file, which I don't even see in the Temporary Internet Files folder!

    Any ideas??
     
  2. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    Need an extra \ on the Path string? Do you have permissions to access that folder? I'm assuming you're using Win2k or WinXP.
     
  3. eric_stlouis

    eric_stlouis New Member

    Joined:
    Oct 10, 2003
    Messages:
    147
    Likes Received:
    0
    Yes, I'm logged in as administrator - I tried with the backslash and that didn't work.
     
  4. Scn64

    Scn64 Guest

    I'd be interested in the answer to this too.
     
  5. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    I'm not surprised - you can't get a directory listing through the command line either.
     
  6. EvilSS

    EvilSS New Member

    Joined:
    Jun 11, 2003
    Messages:
    5,104
    Likes Received:
    0
    Location:
    STL
    The contents of this directory are not real. You won't be able to really clear it out with the fso object. If you go to the command prompt, go to that directory, do a dir /as then a dir /ah. You will see a Content.mso and a Content.IE5 (even if you have IE6). cd Content.IE5 and do another dir /ah and dir /as. You will see a crapload of random direcories. In these are the actual cache files.

    You need to use system calls to do it right. If you are using vb.net, check this Q article:
    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q311/2/89.asp&NoWebContent=1

    These guys have a COM object for clearing the cache and cookies:
    http://dev.remotenetworktechnology.com/wsh/comwsh.htm


    Edit: PS: Don't use explicit paths. Get the correct cache path from the system. Explicit paths are evil. :squint:
     
    Last edited: Aug 2, 2004

Share This Page