微信做了啥我不想多说了,如果你觉得目录难找,可以使用我的程序

这是我对网上程序的更改,因为有长达 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")

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