IE Temporary Internet Files & Python

rtilley rbt at athop1.ath.vt.edu
Thu Nov 10 13:58:53 EST 2005


Tim Golden wrote:
> [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

Thanks a lot Tim. I hadn't been using the win32 extensions... guess I'll 
have to now. How I love Windows ;)



More information about the Python-list mailing list