photo renamer

Kwame Asante 12 months ago
parent 93c2420ee4 commit fc669cd90d0e6ee12af2db9676192fbe15a97ff2
1 changed files with 8 additions and 0 deletions
+8-0rename-photos.sh ADDED
View File
@@ -0,0 +1,8 @@
1+#!/bin/sh
2+# rename IMG_1234.JPG to 2025-10-03_1234.jpg using the file date
3+for f in IMG_*.JPG; do
4+ [ -e "$f" ] || continue
5+ d=$(date -r "$f" +%F)
6+ n=${f#IMG_}
7+ mv -n "$f" "${d}_${n%.JPG}.jpg"
8+done