Created
November 28, 2012 20:46
-
-
Save raullenchai/4164344 to your computer and use it in GitHub Desktop.
Compare the lay out of dir1 and dir2, ignore the content of files
This file contains hidden or 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 os | |
def compare_dir_layout(dir1, dir2): | |
def _compare_dir_layout(dir1, dir2): | |
for (dirpath, dirnames, filenames) in os.walk(dir1): | |
for filename in filenames: | |
relative_path = dirpath.replace(dir1, "") | |
if os.path.exists( dir2 + relative_path + '\\' + filename) == False: | |
print relative_path, filename | |
return | |
print 'files in "' + dir1 + '" but not in "' + dir2 +'"' | |
_compare_dir_layout(dir1, dir2) | |
print 'files in "' + dir2 + '" but not in "' + dir1 +'"' | |
_compare_dir_layout(dir2, dir1) | |
compare_dir_layout('xxx', 'yyy') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment