ExifTool Forum

ExifTool => Newbies => Topic started by: RH on July 30, 2014, 05:28:35 AM

Title: Moving photos to folder by name and model
Post by: RH on July 30, 2014, 05:28:35 AM
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?
Title: Re: Moving photos to folder by name and model
Post by: Phil Harvey on July 30, 2014, 07:17:25 AM
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
Title: Re: Moving photos to folder by name and model
Post by: RH on July 31, 2014, 02:53:15 AM
Thank you.
Title: Re: Moving photos to folder by name and model
Post by: RH on August 01, 2014, 06:25:55 AM
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?
Title: Re: Moving photos to folder by name and model
Post by: Phil Harvey on August 01, 2014, 07:33:29 AM
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
Title: Re: Moving photos to folder by name and model
Post by: RH on August 02, 2014, 03:08:12 AM
It's complicated.

Big thanks.