From ee18f84d1132eb4520e23327de992cf3b57a30d8 Mon Sep 17 00:00:00 2001 From: the1311 Date: Tue, 16 Nov 2021 23:06:11 +0100 Subject: [PATCH] fix division by zero if less than 100 files are copied --- recovery.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recovery.py b/recovery.py index 459e663..8497a74 100755 --- a/recovery.py +++ b/recovery.py @@ -90,7 +90,10 @@ while ((destination is None) or (not os.path.exists(destination))): destination = input('Enter a valid destination directory\n') fileNumber = getNumberOfFilesInFolderRecursively(source) -onePercentFiles = int(fileNumber/100) +if fileNumber > 100: + onePercentFiles = int(fileNumber/100) +else: + onePercentFiles = fileNumber totalAmountToCopy = str(fileNumber) print("Files to copy: " + totalAmountToCopy)