diff --git a/findduplicatedirs.py b/findduplicatedirs.py index 1a1318a..1bbaf83 100755 --- a/findduplicatedirs.py +++ b/findduplicatedirs.py @@ -50,9 +50,12 @@ for (i, (dirpath, dirnames, filenames)) in enumerate(directorywalk): h.update(os.readlink(filename).encode('utf8', 'surrogateescape')) elif os.path.isfile(filename): du += os.path.getsize(filename) - with open(filename, 'rb') as f: - for chunk in iter(lambda: f.read(4096), b''): - h.update(chunk) + try: + with open(filename, 'rb') as f: + for chunk in iter(lambda: f.read(4096), b''): + h.update(chunk) + except PermissionError: + pass # process all directories for dirname in sorted(dirnames): h.update(dirname.encode('utf8', 'surrogateescape'))