@@ -32,6 +32,7 @@ def __init__(
3232 path : str | os .PathLike ,
3333 settling_time : float = 60 ,
3434 appearance_time : float | None = None ,
35+ substrings_blacklist : dict [str , dict ] = {},
3536 transfer_all : bool = True ,
3637 status_bar : StatusBar | None = None ,
3738 ):
@@ -42,6 +43,7 @@ def __init__(
4243 self ._statusbar = status_bar
4344 self .settling_time = settling_time
4445 self ._appearance_time = appearance_time
46+ self ._substrings_blacklist = substrings_blacklist
4547 self ._transfer_all = transfer_all
4648 self ._modification_overwrite : float | None = None
4749 self ._init_time : float = time .time ()
@@ -252,15 +254,26 @@ def _scan_directory(
252254 raise
253255 for entry in directory_contents :
254256 entry_name = os .path .join (path , entry .name )
255- if entry .is_dir () and (
257+ # Skip any directories with matching blacklisted substrings
258+ if entry .is_dir () and any (
259+ char in entry .name
260+ for char in self ._substrings_blacklist .get ("directories" , [])
261+ ):
262+ continue
263+ elif entry .is_dir () and (
256264 modification_time is None or entry .stat ().st_ctime >= modification_time
257265 ):
258266 result .update (self ._scan_directory (entry_name ))
259267 else :
260268 # Exclude textual log
261269 if "textual" in str (entry ):
262270 continue
263-
271+ # Exclude files with blacklisted substrings
272+ if any (
273+ char in entry .name
274+ for char in self ._substrings_blacklist .get ("files" , [])
275+ ):
276+ continue
264277 # Get file statistics and append file to dictionary
265278 try :
266279 file_stat = entry .stat ()
0 commit comments