Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Uncovering hidden Internet Explorer cache

by ryddler (Monk)
on Jan 03, 2001 at 22:53 UTC ( #49589=CUFP: print w/replies, xml ) Need Help??

After emptying the IE cache one day, I decided to check the properties of the "Temporary Internet Files" directory to see how many bytes were being used and was curious to find nearly 100 megabytes of files and folders were still being held captive. As many of you (Windoze users) may know, there are certain directories that the OS tries to hide from the user, and in most cases that's probably a really good thing, because I know if my grandfather had access to some of them, I'd be on call a lot more often to fix his machine ;)

Further exploration using a dos window reveals a curious hidden file named "desktop.ini" containing the following lines:


Which presumably tell the OS what to display in the GUI. This file is then also located within several subdirectories containing all the cache files below this level.

After manually removing the "desktop.ini" I discovered that it was immediately put back into place the next time I ran Internet Explorer, so obviously this meant any time I wanted to clear out the cache thoroughly, I would need to manually remove "desktop.ini" from each subfolder I wished to view... Enter perl, and the simple one-liner below will recurse through and delete the "desktop.ini" allowing me to view everything. (why hide it?)

#!perl -w use File::Find; find(sub {unlink "$File::Find::dir/$_" if ($_ eq 'desktop.ini')}, "C:/Windows/Temporary Internet Files");

NOTE: NT users will need to change the path to reflect their profile...


Replies are listed 'Best First'.
(Guildenstern) Re: Uncovering hidden Internet Explorer cache
by Guildenstern (Deacon) on Jan 04, 2001 at 21:13 UTC
    The "curious" desktop.ini file exists so that you can customize how your folder looks. You can give it a custom icon, tooltip text, disable sharing, etc. The .ini file that lives in the Temporary Internet Files folder has a class ID that tells the OS to handle viewing, editing, etc. the contents of the folder via a namespace extension. In this case, the extension refers to the IE Browser COM object via SHDOCVW.DLL.
    The simplest way that I have found to get around this problem is to edit the desktop.ini file and remove the line that contains the "UICLSID=..." bit. I then add a line that says
    InfoTip=This is the IE cache folder
    This makes sure that there is still a desktop.ini file, so that IE won't try to recreate it, but it also disables the handling of the folder's contents through the IE COM object and lets it behave like a normal folder. If you still want access to the "special" IE way of viewing the folder's contents, you can do it through the Options menu in IE.

    Negaterd character class uber alles!

      OK, so melding together the discoveries and knowledge of these two hepcats - er, honorable monks - we might have something like this, maybe?

      #!perl -w use File::Find; use Win32; use strict; find( \&wanted, "J:/ie5cache/Temporary Internet Files" ); sub wanted { my $replacement = 'InfoTip="This is the IE cache folder"'; if ($_ eq 'desktop.ini') { my $DOSname = Win32::GetShortPathName( "$File::Find::dir/$_" ); my $SRT = system( "ATTRIB -h -s -r $DOSname" ); warn "\nUh-oh, not going to work? -\n$!" if $SRT; print( "Found $File::Find::dir/$_", qq[:\n]); open( IEDF, "$File::Find::dir/$_") or die $!; my @contents = <IEDF>; close( IEDF ) or die $!; if (@contents) { for (@contents) { s@UICLSID\=.+@$replacement\n@i; } open ( IEDF, ">$File::Find::dir/$_") or die $!; print IEDF '',@contents,"\nreplacement made.\n"; print '',@contents; close( IEDF ) or die $!; } } }

      There is only a little fruitfly in the ointment. The little line "InfoTip=This is the IE cache folder" does not seem to do anything in my Windows NT4 Explorer interface. Maybe this is (I think so) a Win98-specific innovation?

      Good work anyway brothers, I like seeing my cache in ordinary perspective so I have some greater control over the contents.

      Ok, you've got my attention! Where did you find this wealth of information you've shared here? (Exploring minds want to know ;)

        The information about the desktop.ini file can be found here. Information about namespace extensions is here.
        Both of these topics are listed on Microsoft's MSDN Library under the Shell Programmer's Guide section under the Platform SDK docs.

        Sorry about the OT posts - maybe I'll find some way to get Perl to let a user create a custom desktop.ini for penance.

        Negaterd character class uber alles!
      >Further exploration using a dos window reveals ...
      There is a folder setting to display system and hidden files and to display full file names (with suffixes). You don't need a dos window for that.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://49589]
Approved by root
[thezip]: Our cat is single-handedly (pawed-ly?) solving our field mouse problem. About four critters in the last week alone.
[thezip]: Amazing speed and stealth in that one.
[GotToBTru]: You can't tunafish, but some seafood companies can tunafish. More fun with English.
[virtualsue]: a veterinarian told me to cut down on my cat's food. i said, when i do that she just catches more mice
[thezip]: My dogs are also excellent mousers, at least that's what they tell me.
[GotToBTru]: our beagle has dispatched 3 rabbits to the Great Hutch in the Sky since March.
[thezip]: I can always tell when the dogs have been mousing, as there is a concentric ring of mud around the end of their snouts when they do.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (16)
As of 2017-11-17 19:53 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (272 votes). Check out past polls.