renaming files and location based on metadata dates?

Gareth Walker walkergareth474 at gmail.com
Mon Jul 29 13:41:19 BST 2024


Are you willing to use a shell script to do this? This script uses exiftool
to get the information you need from the photo, makes the required
directories, and copies the photo to the folder:

#!/bin/bash
exifInfo=$(exiftool -CreateDate $1)
year=$(echo $exifInfo | cut -d':' -f 2)
month=$(echo $exifInfo | cut -d':' -f 3)
day=$(echo $exifInfo | cut -d':' -f 4 | cut -d' ' -f 1)
mkdir -p $year/$month/$day
cp $1 $year/$month/$day

(Change the last line from 'cp' to 'mv' to move the photo rather than
copy.)

You could use the script from the command line like this (if you call the
script filePhotos and make it executable):

./filePhotos 20240727-131034-76_v1.jpg

You could run it on a whole bunch of files like this:

for i in *.jpg; do ./filePhotos $i; done

There are probably loads of better ways to write this script, but this
might give you some clues. Your mileage may vary, use at your own risk etc.

Gareth

On Fri, 26 Jul 2024 at 13:54, stumpy <stumpy at posteo.co> wrote:

> Hi, I have been trying to figure out how to move my photos, using
> digikam, to a structure of year month day, something like:
>
> YYYY/MM/DD/original_file_name.heic (or jpg, or dng, etc)
>
> Catch is I can't seem to figure it out. I've tried mainly using the
> batch que manager but gave up after renaming all my test files
>
> "YYYY/MM/DDorigonalfilename.jpg" (I didn't' even know I could have a "/"
> in the actual file name?
>
> I am using the v8.4.0 on debian... and would super apprecaite any help
> anyone might be able to provide
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-users/attachments/20240729/065c2b7a/attachment.htm>


More information about the Digikam-users mailing list