删除windows 垃圾文件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#coding:utf-8
import os
#from glob import glob

if os.name == 'nt':
	if 'HOMEPATH' in os.environ:
		home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
	else:
		home = os.environ['HOMEPATH']

workpath = os.path.join(home, 'Local Settings')
#�ݹ�ɾ���ļ�
#���������ĺ�����try���׳�ɾ������ʹ�õ���ʱ�ļ�����
def delfile(path):
	for file in os.listdir(path):
		if os.path.isfile(os.path.join(path, file)):
			try:
				print "\nɾ�������ļ��� %s" % (os.path.join(path, file))
				os.remove(os.path.join(path, file))
			except:
				pass
		elif os.path.isdir(os.path.join(path, file)):
			delfile(os.path.join(path, file))
		else:
			pass
#delfile(os.path.join(workpath, 'Temp'))
#delfile(os.path.join(workpath, 'Temporary Internet Files'))
#ɾ���ļ��ҵ�ʱ�����Ϊ���ļ��У�����ֻ�ܴ������ɾ��
def deldir(pa):
	for i in os.listdir(pa):
		if os.path.isdir(os.path.join(pa, i)):
			if len(os.listdir(os.path.join(pa, i))) > 0:
				deldir(os.path.join(pa, i))
				try:
					os.rmdir(os.path.join(pa, i))
				except:
					pass
			else:
				try:
					print "\nɾ���ļ��� %s" % (os.path.join(pa, i))
					os.rmdir(os.path.join(pa, i))
				except:
					pass

#deldir(os.path.join(workpath, 'Temp'))
#deldir(os.path.join(workpath, 'Temporary Internet Files'))
print """
     ϵͳ��������ʱ�����ļ�������ϣ�
     """
raw_input("�밴�س����˳���")

def md(str):
    import md5
    a = md5.new
    m.update(str)
    return m.hexdigest().lower()

mm = md("jalfIau4hwuXie7")
print mm

print md("%s%s%s"%(mm,"ingrealw-2332682",'123456'))