Created
March 31, 2018 23:10
-
-
Save JamesMcMahon/84e6769eed96deb3e28f401fdfbf8b30 to your computer and use it in GitHub Desktop.
Script to compare just directory names
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
#!/usr/bin/env python | |
import os | |
import sys | |
def remove_prefix(text, prefix): | |
if text.startswith(prefix): | |
return text[len(prefix):] | |
return text | |
path1 = sys.argv[1] | |
path2 = sys.argv[2] | |
dirs1 = set([remove_prefix(dp, path1) for dp, dn, fn in os.walk(path1)]) | |
dirs2 = set([remove_prefix(dp, path2) for dp, dn, fn in os.walk(path2)]) | |
print('\n'.join(dirs1 - dirs2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment