Created
January 22, 2019 22:15
-
-
Save cmpute/85069c2071a92b2857ec27566eceaf4a to your computer and use it in GitHub Desktop.
Directory Comparar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import filecmp | |
import os.path as osp | |
dir_a = "E:/" | |
dir_b = "F:/" | |
def print_diff_files(dcur, dcmp): | |
for name in dcmp.diff_files: | |
print("[diff_file @ %s ] %s" % (dcur, name)) | |
for name in dcmp.left_only: | |
print("[left_only @ %s] %s" % (dcur, name)) | |
for name in dcmp.right_only: | |
print("[right_only @ %s] %s" % (dcur, name)) | |
for sub, sub_dcmp in dcmp.subdirs.items(): | |
print_diff_files(osp.join(dcur, sub), sub_dcmp) | |
print_diff_files('\\', filecmp.dircmp(dir_a, dir_b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment