Skip to content

Instantly share code, notes, and snippets.

@cmpute
Created January 22, 2019 22:15
Show Gist options
  • Save cmpute/85069c2071a92b2857ec27566eceaf4a to your computer and use it in GitHub Desktop.
Save cmpute/85069c2071a92b2857ec27566eceaf4a to your computer and use it in GitHub Desktop.
Directory Comparar
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