IE Temporary Internet Files & Python

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Nov 10 11:43:22 EST 2005


[rtilley]

> Below is a script that recursively deletes files from a directory. It 
> works well on the two directories that I'm currently using it on:

> C:\Documents and Settings\user\Cookies
> C:\Documents and Settings\user\Temp

> However, I'd like to use it on this directory as well:

> C:\Documents and Settings\user\Temporary Internet Files

> The script does not seem to work when used on Temporary Internet
Files. 
> I've googled around a bit, but haven't found any tips... thought I'd 
> trouble the list for an answer or at least some explanations.

> Feel free to critiqe the script as well. Perhaps it's a programmer
error.

Temporary Internet Files is one of those special shell folders
and, I suspect, isn't really a folder at all in the normal sense:
it just presents itself as one to the O/S. (Might be wrong there).
Probably means you have to use shell functions to access it.
Quick trial with SHFileOperation works up to a point, but ultimately
fails with a file-in-use error.

This article: 

http://www.codeguru.com/Cpp/I-N/ieprogram/article.php/c1245/

uses a very different technique. The APIs in question aren't
wrapped in pywin32. You could probably get at them via ctypes.
Don't have time to try it myself at the moment.

TJG

PS Probably doesn't matter at the mo, but for general purpose
use, those folders aren't always where your script hardwires
them to be. You might need to look at the shell functions
around SHGetPathFromIDList and SHGetSpecialFolderLocation.
Tim

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list