Moving photos to folder by name and model

Started by RH, July 30, 2014, 05:28:35 AM

Previous topic - Next topic

RH

Hi,
I am trying to move photos to directory and to subdirs - directory is date the picture was taken and subdir name of model of camera (Date/ModelName/*.jpg).

exiftool -d "%Y-%m-%d" "-directory<datetimeoriginal" *.jpg

This move pictures to Date/.

The problem is: how to use ${model}? Can anybody help me?

Phil Harvey

exiftool -d "%Y-%m-%d" "-directory<$datetimeoriginal/${model;}" -ext jpg .

Here I have added a filter on the model string to remove illegal characters (see the explanation of the advanced formatting feature in the -p section of the application documentation).  Also, the above quoting is for Windows.  Use single quotes instead on Mac/Linux.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


RH

Is it possible in one cmd to move files to direcoty as above and also rename like this:

(from batch file)

exiftool -d "%%Y%%m%%d_%%H%%M%%S%%%%-.2nc.%%%%e" "-filename<$datetimeoriginal" -ext jpg .

I mean combination of moving to directory $datetimeoriginal/${model;} and renaming -filename<datetimeoriginal?

Phil Harvey

It is not easy to insert the value of a tag in between fields of a formatted date/time value, but for what you want it can be done like this:

exiftool -d "%%Y%%m%%d_%%H%%M%%S%%%%-.2nc.%%%%e" "-filename<${datetimeoriginal#;s/ .*//;tr/:/-/}/${model;}/$datetimeoriginal" -ext jpg .

Here I have had to do the formatting of the directory name manually (using the advanced formatting feature) because the model name can not be embedded into the date/time format string.  I have also doubled the % characters as you had done for use in a BAT file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

RH