diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 74f9e4b77e..7bec32db70 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -219,8 +219,8 @@ def mi_to_html( else: data_path = os.path.join(path, DATA_DIR_NAME) with suppress(OSError): - for de in os.scandir(data_path): - if de.is_file(): + for dirpath, dirnames, filenames in os.walk(data_path): + if filenames: num_of_folders = 2 break text = _('Book files')