-Directory & - Filename in one command?

Started by EvilUnicorn, November 19, 2022, 05:30:07 AM

Previous topic - Next topic

EvilUnicorn

With help I've gotten far enough to have two working commands that do perfectly what is needed. Now I have to admit that playing with this tool is getting quite fun and challenging. Especially to get more advanced commands working. So, absolutely not necessary but wondering: can I make these two commands into one, and if so what's wrong with what I'm trying. Most of the times the answer is simply in the excellent docs but I'm not seeing it.

1st:
exiftool -ext JPG (or -ext .RW2) -r -d '%Y/%m - %B' '-Directory<DESTDIR$CreateDate/${make} - ${model;}' SRCDIR

2nd:
exiftool -r -d '%Y%m%d-%H%M%%-c.%%e' '-filename<CreateDate' SRCDIR\*.RW2 or SRCSIR\*.JPG


Since I can't declare -d more than once, I think I need to 'reset' it. I've gotten to this so far:
exiftool -ext JPG -r -d '%Y/%m - %B' '-Directory<$CreateDate/${make} - ${model;}' -Filename<${createdate#;DateFmt("%Y-%m-%d_%H%M%S")}.%e' *.JPG

This results in too many errors ;-) Perhaps filename and directory shouldn't be combined?

Final challenge is: How to get the .JPG and .RW2 in its own folder structure? In other words how to specify two DESTDIR depending on the -ext tag?

Regards


Phil Harvey

You were very close.  I think you just missed one quote before the -filename argument:

exiftool -ext JPG -r -d '%Y/%m - %B' '-Directory<$CreateDate/${make;} - ${model;}' '-Filename<${createdate#;DateFmt("%Y-%m-%d_%H%M%S")}.%e' *.JPG

I also added a semicolon after "make" in case it contains illegal characters.

I think this should work, but I didn't have time to test it.

- 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 ($).