add check for existing path
This commit is contained in:
parent
226d5e9bb2
commit
b6f9479bf7
1 changed files with 30 additions and 27 deletions
|
@ -103,6 +103,7 @@ class find_duplicate_files:
|
||||||
def recursive_scandir(self, path, ignore_hidden_files=True):
|
def recursive_scandir(self, path, ignore_hidden_files=True):
|
||||||
''' Recursively scan a directory for files'''
|
''' Recursively scan a directory for files'''
|
||||||
files = dict()
|
files = dict()
|
||||||
|
if os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
for file in os.scandir(path):
|
for file in os.scandir(path):
|
||||||
if self.limit > 0 and len(files) > self.limit:
|
if self.limit > 0 and len(files) > self.limit:
|
||||||
|
@ -130,6 +131,8 @@ class find_duplicate_files:
|
||||||
except PermissionError as error:
|
except PermissionError as error:
|
||||||
self._log.warning(f"# Permission denied accessing folder '{path}'")
|
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.")
|
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
|
return files
|
||||||
|
|
||||||
def _init_log(self):
|
def _init_log(self):
|
||||||
|
|
Loading…
Reference in a new issue