微信做了啥我不想多说了,如果你觉得目录难找,可以使用我的程序
这是我对网上程序的更改,因为有长达2个月的附件,进行了2个月的归档,网上只能全迁移到6月份文件夹,我觉得不爽
注意:
迁移完后,微信聊天记录会显示已被清理
个人是直接把MsgAttach全删了,有些图片会查看不了,没啥大问题

import shutil
import os


def move_file(old_path, june_catalogue, july_catalogue):
    filelist = os.listdir(old_path)
    for file in filelist:
        src = os.path.join(old_path, file)
        filelist2 = os.listdir(src)
        for file2 in filelist2:
            if file2 == 'File':
                src1 = os.path.join(src, file2)
                filelist3 = os.listdir(src1)
                for file3 in filelist3:
                    src2 = os.path.join(src1, file3)
                    filelist4 = os.listdir(src2)
                    for file4 in filelist4:
                        src3 = os.path.join(src2, file4)
                        if src2.endswith('6'):
                            new_path3 = july_catalogue
                        else:
                            new_path3 = june_catalogue
                        if os.path.exists(os.path.join(new_path3, file4)):
                            continue
                        else:
                            shutil.move(src3, new_path3)


if __name__ == '__main__':
    # 改为自己的文件夹的绝对路径
    move_file("D:\\dyedd\\Documents\\WeChat Files\\微信id\\FileStorage\\MsgAttach",
              "D:\\dyedd\\Documents\\WeChat Files\\微信id\\FileStorage\\File\\2022-06",
              "D:\\dyedd\\Documents\\WeChat Files\\微信id\\FileStorage\\File\\2022-07")

懒得写成果提示了,运行后就看看文件夹有没有多出来就好了

版权属于:染念
作品采用:本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
更新于: 2022年07月22日 16:16
11
发表评论


180 文章数
673 评论量
4 分类数
184 页面数
已在风雨中度过 7年68天20小时8分
目录
来自 《将PC微信本地文件从MsgAttach文件夹转移回原先的File文件夹-更加智能》
© 2024 染念Blog
浙ICP备19020194号-1
暗黑模式
暗黑模式
评论
返回顶部
© 2024 染念Blog
浙ICP备19020194号-1
暗黑模式
暗黑模式
评论
返回顶部