add check for existing path

This commit is contained in:
Antonio J. Delgado 2023-01-28 10:38:55 +02:00
parent 226d5e9bb2
commit b6f9479bf7

View file

@ -103,6 +103,7 @@ class find_duplicate_files:
def recursive_scandir(self, path, ignore_hidden_files=True):
''' Recursively scan a directory for files'''
files = dict()
if os.path.exists(path):
try:
for file in os.scandir(path):
if self.limit > 0 and len(files) > self.limit:
@ -130,6 +131,8 @@ class find_duplicate_files:
except PermissionError as error:
self._log.warning(f"# Permission denied accessing folder '{path}'")
self._log.debug(f"# Found {len(files)} files in '{path}'. Cache contains {self._cache_size()} records.")
else:
self._log.warning(f"# Folder '{path}' doesn't exist")
return files
def _init_log(self):