http://www.perlmonks.org?node_id=145623
Category: Win32 stuff
Author/Contact Info cLive ;-) - clive@brandx.net
Description: Finds and removes those nasty "index.dat" files that IE hide on your Windows machine. For more information, see this article.
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;

my $c=0;
my @files = ();

# find the files
print "Processing\n";
find(\&wanted, "/");

# offer for delete:
for (@files) {
  print "\nDelete $_?(y/n)\n";
  my $r = <STDIN>;
  if ($r =~ /y/i) {
    unlink $_;
    print "FILE DELETED!\n";
  }
}

sub wanted {
  print '.' if !$c; $c++;$c%=1000;
  push @files, $File::Find::name if (/index.dat/);
}
Replies are listed 'Best First'.
Re: Deleting Microsoft's hidden web caches created by IE5
by Amoe (Friar) on Feb 15, 2002 at 19:58 UTC

    Small quibble - you might want to escape the dot in your file matching pattern. As I'm sure you knew, but I'm telling you to be annoying, . matches any character, whereas you probably meant:

    push @files, $File::Find::name if /index\.dat/;

    --
    my one true love
(cLive ;-) Re: Deleting Microsoft's hidden web caches created by IE5
by cLive ;-) (Prior) on Feb 16, 2002 at 04:56 UTC
    Ah, yes, valid point. And as crazyinsomniac points out - don't try to run this in Windows - boot to DOS first! (f8 at boot, I think :)

    cLive ;-)

    -- seek(JOB,$$LA,0);

      first, you must direct the File::find to your current dir (or it will treat the target "Local setting" directory as if it is on c: root find(\&wanted, "c:\/Documents and Settings\/YourUser\/Local Settings"); second - perl cant unlink the file (locked -> permission denied"). i use overwrite, which also takes care of the undelete problem: use File::Copy; copy('c:\empty.txt',$_)||$!;
Re: Deleting Microsoft's hidden web caches created by IE5
by Anonymous Monk on Mar 25, 2003 at 01:35 UTC
    This formula is too complicated for me. But I pulled an excellent article from www.nethole.com. I had entered dir/s and dir/s/as, before using a window washer so had idea of all the sites I had visited from day one listed right there. Window washers do some good but did not get all the urlcaches but did delete a good deal from this directory. c:\windows\dir/s Go to start/run/ type in "Regedit" the "Registry Editor" will pop up, go to "Edit" click on "Find" type in "TypedURLs" then hit "Find Next.” You will be taken to all the places you have typed in URLs manually. Erase any URLs that you find. DO NOT ERASE THE FOLDERS. Outlook express is another strong hold for these client Urlcaches and HP even had a list of all the sites I had down loaded and printed. Also go to "Tools" "Internet Options" "Content" "Auto Complete" and un click "Web Address" "Forms" and "User Names And Password On Forms" this will take away the memory of your name and SSN so you will no longer be able to left click and have your name and SSN appear on the form and you will no longer have a history of URLs under your address bar but there are at least two other url that will store this address for you. AL Holdings
Re: Deleting Microsoft's hidden web caches created by IE5
by zentara (Archbishop) on Feb 16, 2002 at 18:07 UTC
    After reading the article, maybe just deleting the files may not be enough, since MS might wise up and just undelete the file. So what would be a good wipe routine to run on $_ before doing the unlink? Split it into characters and replace each character with 0? Ideas?
      descartes wrote an implementation of the Orange Book's shred program, which is apparently a pretty good way of truly zapping files, if it's the contents of the file you're worried about.


      print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'