My first useful script: renamed 400 holiday photos

OliviaPyOP

Phone + camera photos had different naming schemes, so sorting by name was chaos. Wrote a script that reads the date from each file and renames everything to 2026-08-14_153012.jpg. 400 photos in two seconds. Feels like magic.

9

Comments 6

Join the discussion

Already have an account? Log in

  1. LiamBytereplies: 1

    This is the best kind of first project. Did you read EXIF data or the file modification time?

    1
    1. OliviaPyOP

      EXIF with Pillow, falling back to modification time when EXIF is missing (screenshots, mostly).

      0
    2. BellaRossireplies: 1

      Nice fallback. Did you handle two photos taken in the same second?

      0
      1. OliviaPyOP

        Not at first... two photos overwrote each other 😬 Now I add _1, _2 if the name exists. Lesson learned: always test on a copy.

        2
      2. NoahLoops

        "Always test on a copy" is the real lesson of every file script ever.

        4