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) --------------------------------------------------- -- http://mail.python.org/mailman/listinfo/python-list