473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

IE Temporary Internet Files & Python

A bit off-topic, but Python related.

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.

rbt

----------------------------------------

import os
import os.path

userpath = 'C:/Documents and Settings/'
userlist = os.listdir(userpath)

# Make sure that userlist only contains directories, no files.
for u in userlist[:]:
if os.path.isdir(userpath+u):
pass
else:
userlist.remove(u)

def remove_files(target_dir):
fp = file('remove_temp_files.txt', 'a')
for root, dirs, files in os.walk(target_dir):
for f in files:
try:
os.unlink(os.path.join(root, f))
print >> fp, "Removed:", os.path.join(root,f)
except OSError:
pass
fp.close()

# Remove 'Local Settings|Temp' files
for username in userlist:
target_dir = userpath+username+'/Local Settings/Temp/'
#print target_dir
remove_files(target_dir)

# Remove IE Cookies
for username in userlist:
target_dir = userpath+username+'/Cookies/'
#print target_dir
remove_files(target_dir)

---------------------------------------------------
Nov 10 '05 #1
2 2324
The script does not seem to work when used on Temporary Internet Files.

Doesn't work well? What does it mean? Is there an exception raised?

Les

Nov 10 '05 #2
Laszlo Zsolt Nagy wrote:
The script does not seem to work when used on Temporary Internet Files.

Doesn't work well? What does it mean? Is there an exception raised?

Les


No exception. The files are not deleted.
Nov 10 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: phpninja | last post by:
Greetings, I was wondering if it is possible to delete someone's temporary internet files with javascript? Basically I'm am using a PDF module called HTML_ToPDF. The pdf module takes some output...
5
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true...
3
by: Jim | last post by:
Is it possible to read the Temporary Internet Files folder using C#? I'm messing with FileIO (newbie here) and everything seems to work fine until I try to read the list of files in this Temporary...
3
by: Rajiv Das | last post by:
VS 2003, XP SP2 ------------------------------------------------------------ DirectoryInfo temporary = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));...
0
by: VZUmar | last post by:
Hi I am using IWebBrowser2 in my VC++ windows Application, My application uses browser control to navigate through different web pages. IE of machine has Security setting "Empty Temporary Internet...
7
by: Norton | last post by:
Hi all, I would like to know if there is any method in asp or asp.net to direct the browser to download a file into the Temporary Internet Files directory so that i can make use of vb script to...
4
by: Nicolás Castagnet | last post by:
Hi, I write this post because I notice a strange behavior related with "Temporary Internet Files" and maybe some of you can help me to understand it. I am working in a web application with...
1
by: Manish | last post by:
Hi all, Can any one plz suggest me how i can delete my temporary internet files within my Asp.net page. I am using C# as the code behind lang. Indeed, i have flash inserted on my .net page,...
5
by: rogersw8n | last post by:
Some how, some way the account that creates folders under Temporary Internet files has been changed to a domain account for VS 2003 and VS 2005. I recently installed VS 2005. All seemed to be ok...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.