help with directory split

Started by lfcnutter, November 24, 2024, 06:37:09 AM

Previous topic - Next topic

lfcnutter

i've found the topic on using command to print directory as below

exiftool -p "${directory;s(.*/)()}" "c:/photostore/photos/2011/2011-01" -r

which gets me "2011-01"

I'd like to incorporate the directory split into a csv output  with several other tags.

I've tried to adapt to command but failed.
can anyone help me please?

greybeard

How about:

exiftool -p "$make,$model,${directory;s(.*/)()}" -r "c:/photostore/photos/2011/2011-01"

StarGeek

Splitting the directory like that can't be used with the -csv option, if that was what you were looking to do. You would instead have to create the CSV file using the -n (--printConv) option as greybeard shows.

A problem arises if there are commas in the data. FAQ #12 "How do I export information from exiftool to a database?" gives a way to fix this using the -api Filter option. Look to the end of that FAQ where it says "in a Windows CMD shell/in Mac/Linux"
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

greybeard

I generally use the pipe symbol if there is any chance of commas in the data:

exiftool -p "$make|$model|${directory;s(.*/)()}" -r "c:/photostore/photos/2011/2011-01"

lfcnutter

thanks both for the speedy and accurate response.
I'm now well on the way to completing my project.