本工具采用Python编写,先读取“%userprofile%\AppData\Roaming\Tencent\WeChat\All Users\config\3ebffe94.ini”,确定WeChat Files文件夹的位置,进行扫描,列出所有登陆过的微信号,让用户选择清理的对象,再列出菜单,通过if语句让用户来决定删除哪些数据,最后进行删除操作。
Python] 纯文本查看 复制代码
?
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | import os def delete(files): os.system( 'del /f /s /q "%s\\*.*"' % files) print ( "清理成功!" ) users = os.path.expandvars( '$HOMEPATH' ) f = open (r 'C:' + users + '\\AppData\\Roaming\\Tencent\\WeChat\\All Users\\config\\3ebffe94.ini' ) if f = = 'MyDocument:' : location = 'C:' + users + '\Documents\WeChat Files' else : location = f.read() + "\WeChat Files" list = os.listdir(location) list .remove( 'All Users' ) list .remove( 'Applet' ) print ( """ """ ) print ( list ) print ( """ """ ) while True : temp = input ( "选择你要清理的微信号:" ) try : if 0 < int (temp)< = len ( list ): temp1 = int (temp) - 1 wxid = list [temp1] break else : print ( "输入错误,请重新输入。" ) except : print ( "输入错误,请重新输入。" ) print ( """ -----------------------------Windows微信清理工具------------------------------------- ------------------------------【1.清理聊天记录】--------------------------------- -----------------------------【2.清理图片和视频】----------------------------------- -----------------------------【3.清理接收到的文件】------------------------------ ------------------------------【4.清理全部数据】------------------------------- """ ) while True : choice = input ( "请输入要执行的操作所对应的代码:" ) if choice = = '1' : dialog = location + "\\" + wxid + '\Msg' delete(dialog) break elif choice = = '2' : pictures = location + "\\" + wxid + '\FileStorage\Image' delete(pictures) videos = location + "\\" + wxid + '\FileStorage\Video' delete(videos) break elif choice = = '3' : documents = location + "\\" + wxid + '\FileStorage\File' delete(documents) break elif choice = = '4' : delall = location + "\\" + wxid delete(delall) break else : print ( "输入错误,请重新输入。" ) |
开源地址:https://github.com/yunlongzhuhuo/Windows-WeChat-Clean-Up-Tool
郑重声明:本程序要求输入微信号只是为了定位文件夹位置,没有对网络进行连接的任何操作,同时,我也不能访问你的任何聊天记录,因为它们都是加密的。本工具只是提供了一个便捷的渠道来删除文件,我对误删操作概不负责,请谨慎操作!
EXE成品本工具采用Python编写Windows微信清理工具.zip-互联网文档类资源-CSDN下载