Reading files from Temporary Internet Files directory

Greetingz,

i'm trying to read files from the Temporary Internet Files in order to delete them in a .Net 2.0 app. Therefore I used for example

My.Computer.FileSystem.GetFiles(sPath) in VB or

System.IO.Directory.GetFiles(sPath, "*.*"); in c#.

Finally only one file called "desktop.ini" is found in that directory, which is simply wrong because there are serveral more files in that directory.
I used that way of checking files out in a lot of other directories exspecially hidden directories and therefore it works fine. Now whats the matter with that "Temporary Internet Files" directory and is there a way get this fixed.

tHx a lot
KidSteele  



Answer this question

Reading files from Temporary Internet Files directory

  • pgiuseppe

    The Temporary Internet Files folder is not an actual physical folder but is a virtual folder. You can see it in Explorer because a shell extension viewer is registered for it. It actually uses just two (as far as I know) files, index.dat and desktop.ini, to provide the illusion of an actual folder structure.

    I don't think GetFiles can read virtual folders, so you might have to find another solution.

  • mjl

    Hello,

    While I am not an expert on the Shell or Internet Explorer, I believe "Temporary Internet Files" is actually a folder with other sub-folders in it.
    The Shell attempts to abstract this away by displaying it in via a shell extension. However, viewing via the file system (as with the File I/O APIs) would require more understanding of the directory layout.

    I would recommend looking at sub-folders, and also posting your question on a Windows, Shell, or IE development alias.

    Hope that helps,
    Stephen [Microsoft Common Language Runtime: Security - Developer]
    http://blogs.msdn.com/stfisher

     



  • David Guyer MS

    If you print sPath to the screen, is it the right place

  • hangkous

    Please, everyone, do you not realize the folder 'Local Settings' is marked hidden   GetFiles does not see hidden files.
  • gbarendt

    Hi,

    I checked the path over and over and I'm absolutly sure that the path is correct. In first place I read the path with the directory methods of the framwork and later I copied and paste the path from the explorer and inserted it hard coded just for testing. The error has to be another one Tongue Tied

    Greetz
    KidSteele

  • Brainwires

    Sadly I don't think it's quite as simple as just a subdirectory.

    You will find that if you use the commandline, that the "Temporary Internet Files" folder does not exist under "C:\Docunments and Settings\username\local settings\" ... so it must be stored somewhere else. check your environment variables and internet settings, thay may put you on the right path.

    -Aequitas


  • Reading files from Temporary Internet Files directory