fix: list remove value-error

This commit is contained in:
Dineshkarthik 2020-12-27 15:25:34 +01:00
parent f2ff0b6205
commit 993a41580e
No known key found for this signature in database
GPG key ID: E256EF0EECD6F201

View file

@ -62,6 +62,7 @@ def manage_duplicate_file(file_path: str):
file_base_name: str = "".join(posix_path.stem.split("-copy")[0:-1])
name_pattern: str = f"{posix_path.parent}/{file_base_name}*"
old_files: list = glob.glob(name_pattern)
if file_path in old_files:
old_files.remove(file_path)
current_file_md5: str = md5(open(file_path, "rb").read()).hexdigest()
for old_file_path in old_files: