473,661 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\C ookies
C:\Documents and Settings\user\T emp

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

C:\Documents and Settings\user\T emporary 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(user path)

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

def remove_files(ta rget_dir):
fp = file('remove_te mp_files.txt', 'a')
for root, dirs, files in os.walk(target_ dir):
for f in files:
try:
os.unlink(os.pa th.join(root, f))
print >> fp, "Removed:", os.path.join(ro ot,f)
except OSError:
pass
fp.close()

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

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

---------------------------------------------------
Nov 10 '05 #1
2 2338
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
10201
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 based on queries and creates a pdf, and it works great. My problem is, if i make a change to the data in the database, then rerun that exact pdf routine (done by clicking a form button that reposts the data), the pdf that is refreshed in the...
5
16770
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 and no files are deleted in the folder. The peculiarity of this issue is that the files/subfolders cannot be seen through the windows explorer either. I can only access/delete them through a command shell. Any ideas?
3
6122
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 Internet Files folder. I'm only received 1 file when I know there is more. Any suggestions are very appreciated. Thanks
3
3903
by: Rajiv Das | last post by:
VS 2003, XP SP2 ------------------------------------------------------------ DirectoryInfo temporary = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)); FileInfo files = temporary.GetFiles(); foreach(FileInfo fi in files) { Console.WriteLine(fi.FullName); }
0
1830
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 Files folder when browser is closed" selected or enabled. Since my application used WebBrowser Control temporary internet files are not deleted. How can I force IWebBrowser2 Control to do cleanup of IE Temporary files whe my application exits ...
7
2301
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 do the further process ie. tells IE to download my desired Word File into the Temporary Internet Files and call an office com object to open it
4
2342
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 ASP.NET. Recently, I group of user have problems with it because the values of the sessions were not stored correctly (the application save the username in a login page, then other page try to get it and the result was always ""). We restart the web...
1
4292
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, which in turn gets its values from the xml file which gets generated at the run time according to the selection of the user in a DropDownList. I want to delete the flash from the "temporary internet files " folder so that on each combobox...
5
3417
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 afterwards. I did no development for a couple of weeks, came back and I kept receiving Access Denied to Microsoft.Net\Temporary Internet Files\... Access is Denied. ASPNET had full access to that file and all subfolders. The website I am...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.