目录差异对比

2019/03/25 09:49
阅读数 79

bash

diff -rq -x 'filter_path' 'dir1' 'dir2'

python

import filecmp
def dir_compare(src, target, ignore=[]):
    def diff_files(dcmp):
        for name in dcmp.diff_files:
            diff_rst.append(os.path.join(dcmp.left, name))
        for name in dcmp.left_only:
            diff_rst.append(os.path.join(dcmp.left, name))
        for sub_dcmp in dcmp.subdirs.values():
            diff_files(sub_dcmp)

    diff_rst = []
    dcmp = filecmp.dircmp(src, target, ignore)
    diff_files(dcmp)
    return (diff_rst)
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部