Ignore broken symlinks/files that disappear
This commit is contained in:
parent
970aad33df
commit
3b3770d46a
@ -101,11 +101,17 @@ def run(verbosity=1, test=False):
|
|||||||
for path, _, files in os.walk(current_dir):
|
for path, _, files in os.walk(current_dir):
|
||||||
for f in files:
|
for f in files:
|
||||||
p = os.path.join(path, f)
|
p = os.path.join(path, f)
|
||||||
st = os.stat(p)
|
try:
|
||||||
if not stat.S_ISREG(st.st_mode) or p == bitrot_db:
|
st = os.stat(p)
|
||||||
continue
|
except OSError as ex:
|
||||||
paths.append(p)
|
#import pdb; pdb.set_trace()
|
||||||
total_size += st.st_size
|
if ex.errno != 2:
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
if not stat.S_ISREG(st.st_mode) or p == bitrot_db:
|
||||||
|
continue
|
||||||
|
paths.append(p)
|
||||||
|
total_size += st.st_size
|
||||||
paths.sort()
|
paths.sort()
|
||||||
for p in paths:
|
for p in paths:
|
||||||
st = os.stat(p)
|
st = os.stat(p)
|
||||||
|
Reference in New Issue
Block a user