From f8e62d8f5ed26814f02383426237fd4c99a7ad04 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Wed, 22 Jul 2020 22:13:39 -0700 Subject: [PATCH] Revert "Fix FileExistsError when filename differs only in case and export-as-hardlink (Bug#133)" --- osxphotos/photoinfo/_photoinfo_export.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osxphotos/photoinfo/_photoinfo_export.py b/osxphotos/photoinfo/_photoinfo_export.py index ca000ac8..6cb42324 100644 --- a/osxphotos/photoinfo/_photoinfo_export.py +++ b/osxphotos/photoinfo/_photoinfo_export.py @@ -34,7 +34,7 @@ from .._constants import ( from .._export_db import ExportDBNoOp from ..exiftool import ExifTool from ..fileutil import FileUtil -from ..utils import dd_to_dms_str, findfiles +from ..utils import dd_to_dms_str ExportResults = namedtuple( "ExportResults", ["exported", "new", "updated", "skipped", "exif_updated"] @@ -428,10 +428,11 @@ def export2( # dest will be file1 (1).jpeg even though file1.jpeg doesn't exist to prevent sidecar collision if not update and increment and not overwrite: count = 1 - dest_files = findfiles(f"{dest.stem}*", str(dest.parent)) - dest_files = [pathlib.Path(f).stem.lower() for f in dest_files] + glob_str = str(dest.parent / f"{dest.stem}*") + dest_files = glob.glob(glob_str) + dest_files = [pathlib.Path(f).stem for f in dest_files] dest_new = dest.stem - while dest_new.lower() in dest_files: + while dest_new in dest_files: dest_new = f"{dest.stem} ({count})" count += 1 dest = dest.parent / f"{dest_new}{dest.suffix}"