#!python3 # https://github.com/hMatoba/Piexif # http://ce3wiki.theturninggate.net/doku.php?id=file_name_convention # destination: // /ab---.jpg from pathlib import Path import datetime as dt import piexif SRC = r'E:\RawByDateArchive' for raw in Path(SRC).glob("**/*.jpg"): fn = raw.name if not raw.is_file(): print(f"skipped {fn}") continue exif_dict = piexif.load(str(raw)) try: model = exif_dict["0th"][piexif.ImageIFD.Model].decode("ascii") idto = exif_dict["Exif"][piexif.ExifIFD.DateTimeOriginal].decode("ascii") except: continue if model != 'FinePix REAL 3D W3': continue rawdt = dt.datetime.strptime(idto,"%Y:%m:%d %H:%M:%S") year = rawdt.year day = f"{rawdt:%Y%m%d}" ts = f"{rawdt:%H%M%S}" destdir = raw.parent stem = f"ab-{day}-{ts}" destfn = destdir / f"{stem}{raw.suffix}" if destfn.exists(): print(f'skipped {destfn}, already exists') continue print(fn, "->", destfn) raw.rename(destfn)