mallen has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to delete temporary internet files from my pc with a script. I am using unlink and rmdir in the script, but when I run it, it seems like it deletes it but when you reboot they show back up. I can delete other files from other folders and they do not show back up. Can someone let me how to fix this. Here is the code I am using.
$user = getlogin; $dir = "C:/Documents and Settings/".$user."/Local Settings/Temporary I +nternet Files"; chdir $dir; opendir(DIR,"$dir") or die "Could not open $dir:$!"; while (my $file=readdir(DIR)){ unlink $file ; system ( 'cmd', '/c', 'rmdir', '/s', '/q' , $dir); } closedir(DIR);

Replies are listed 'Best First'.
Re: Deleting Temporary Internet Files
by Crian (Curate) on Apr 01, 2004 at 15:57 UTC
    You could verify, if your operation was successfully. Perhaps the files are locked by the internet explorer.
Re: Deleting Temporary Internet Files
by inman (Curate) on Apr 01, 2004 at 16:34 UTC
    Why don't you just check the 'Empty temporary files when IE closes' option on the Advanced options page?
      Can you add something to the script to check that box. Because our salesforce will not go out and check the box. It would be easier to do this than have all salesman send their laptop in for it.
        Yes - Microsoft have a tool called the IE Administration Kit (or something like that). This tool allows you, the administrator, to define a policy for IE. This policy includes which UI elements can be changed by the user and which settings are in force. The settings are pushed down to the individual browser using a set of configuration files downloaded from the location in Tools|Internet Options | Connections | LAN Settings. The 'Use Automatic Configuration' checkbox needs to be checked.

        The initial configuration can be carried out by distributing the files or registry settings to the users in the same way as you would have done for your Perl script. This only needs to be done once to set the 'auto configure' information. Every time that the users load IE, the latest configuration will be restored.