ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: lfcnutter on November 24, 2024, 06:37:09 AM

Title: help with directory split
Post by: lfcnutter on November 24, 2024, 06:37:09 AM
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?
Title: Re: help with directory split
Post by: greybeard on November 24, 2024, 07:03:45 AM
How about:

exiftool -p "$make,$model,${directory;s(.*/)()}" -r "c:/photostore/photos/2011/2011-01"
Title: Re: help with directory split
Post by: StarGeek on November 24, 2024, 09:47:04 AM
Splitting the directory like that can't be used with the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE), if that was what you were looking to do. You would instead have to create the CSV file using the -n (--printConv) option (https://exiftool.org/exiftool_pod.html#n---printConv) 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?" (https://exiftool.org/faq.html#Q12) gives a way to fix this using the -api Filter option (https://exiftool.org/ExifTool.html#Filter). Look to the end of that FAQ where it says "in a Windows CMD shell/in Mac/Linux"
Title: Re: help with directory split
Post by: greybeard on November 24, 2024, 10:07:41 AM
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"
Title: Re: help with directory split
Post by: lfcnutter on November 25, 2024, 11:36:36 AM
thanks both for the speedy and accurate response.
I'm now well on the way to completing my project.