Commit 9db35f85 authored by Carsten Emde's avatar Carsten Emde
Browse files

Improved performance of directory skipping

parent adc39b77
......@@ -470,17 +470,12 @@ def main(argv):
dirwalker = os.walk(dirtoscan)
for direntry in dirwalker:
for filename in direntry[2]:
fullfilename = os.path.join(direntry[0], filename)
# Exclude specified directories
skip = False
for skipdir in skipdirs:
if fullfilename.startswith(skipdir):
skip = True
if skip:
for root, dirs, files in os.walk(dirtoscan, topdown = True):
[dirs.remove(d) for d in list(dirs) for s in skipdirs if root.startswith(s)]
for filename in files:
fullfilename = os.path.join(root, filename)
if fullfilename == []:
# Exclude broken links
......@@ -518,7 +513,7 @@ def main(argv):
targetfile = os.path.relpath(targetfile, '/')
targetfile = os.path.join(dirtoscan, targetfile)
targetfile = os.path.normpath(os.path.join(direntry[0], targetfile))
targetfile = os.path.normpath(os.path.join(root, targetfile))
# then recursively check whether or not symbolic links
# point to other symbolic links or to paths that exist
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment