Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-03-25 21:04 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.