-
-
Save MorganRamsay/66048a81f9e41f106787783e2ad0b2db to your computer and use it in GitHub Desktop.
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
# coding=utf-8 | |
import argparse | |
import logging | |
import os | |
logging.basicConfig(level=logging.DEBUG) | |
logging.getLogger(__name__) | |
def main(): | |
input_path = os.path.abspath(args.input) | |
for root, dirs, files in os.walk(input_path, followlinks=False): | |
if root == input_path: | |
continue | |
if not os.path.islink(root): | |
continue | |
target_path = os.path.realpath(root) | |
message = ['Link: %s (Target: %s)', root, target_path] | |
if not os.path.exists(target_path): | |
logging.error(*message) | |
else: | |
logging.info(*message) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser(description='Test for broken NTFS junction points') | |
parser.add_argument('-i', '--input', action='store', default=r'C:\test', help='Walk folders from this path') | |
args = parser.parse_args() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment