diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index da6f5e52..3f2b5f88 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -746,7 +746,8 @@ def getPanelViewSize(deviceres, size): def sanitizeTree(filetree): chapterNames = {} for root, dirs, files in os.walk(filetree, False): - for i, name in enumerate(files): + # only iterate over original files before renaming + for i, name in list(enumerate(files)): splitname = os.path.splitext(name) newKey = os.path.join(root, f'{i:04}' + splitname[1]) key = os.path.join(root, name)