Extracting keywords with recursive search

Started by poler, October 19, 2023, 10:46:01 AM

Previous topic - Next topic

poler

Hello, I found the following command searching through the forum and LOVE it!  It gives me exactly what I want, a single text file with all of the keywords used in the current directory's *.jpg files with one keyword per line.

exiftool -keywords -sep "\n" -sep "\n" -b --ext txt *.jpg >> Keywords.txt

It is perfect.

The problem is that I cannot figure out how to get this output recursively.  I have tried inserting the -r switch at various locations on the command line, but cannot seem to hit the right spot.

How can I get this particular output, but via a recursive run through all *.jpg files including all subdirectories?

Thank you!

StarGeek

Quote from: poler on October 19, 2023, 10:46:01 AMHow can I get this particular output, but via a recursive run through all *.jpg files including all subdirectories?

There isn't a correct spot to hit.  The problem is the use of the wildcard, which is only going to pass a list of files to exiftool.  From the docs on the -r (-recurse) option

QuoteOnly meaningful if FILE is a directory name.

See also Common Mistake #2, "Over-use of Wildcards in File Names".

You can use a dot to indicate the current directory or you can provide the full path to the directory.

Since you only want jpegs, you also have to usethe -ext (-extension) option to limit processing to those files.  In doing this, there isn't a need to exclude text files.

exiftool -keywords -r -sep "\n" -sep "\n" -b -ext jpg . >> Keywords.txt
"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

poler

Quote from: StarGeek on October 19, 2023, 11:06:26 AMYou can use a dot to indicate the current directory or you can provide the full path to the directory.

...

exiftool -keywords -r -sep "\n" -sep "\n" -b -ext jpg . >> Keywords.txt


I see the syntax now.  And have used with current directory and full path.

Thank you so much!