search a folder(OSX) and return number of files that contain "shot_by_me"?

Started by mcquiff, February 21, 2013, 10:44:23 AM

Previous topic - Next topic

mcquiff

I'm trying to work out how many images in a folder were shot by me (part of a bigger applescript) can i use exiftool to search a folder and search the authorName to return the number of images?

Please

Matt

Phil Harvey

Hi Matt,

You could try something like this:

exiftool if '$author =~ /matt/i' -none -r DIR

This will list all of the matching files and give you a count in the summary.  The -none is the name of any tag that doesn't exist (to suppress other output).

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

mcquiff

I've entered this


exiftool if '$author =~ /Shot_by_Matt/i' -none -r ~/Music/

it gives me a list and the result is 518

the Run this

exiftool if '$author =~ /Shot_by_Shah/i' -none -r ~/Music/

And the result is the same.

Is search term to wide?

Many Thanks for getting back

Matt

not sure its looking at it?



Phil Harvey

Quote from: mcquiff on February 22, 2013, 05:44:47 AM
it gives me a list and the result is 518

Result?  You mean all files failed the condition?

You should test this on a file you know contains the string "Shot_by_Matt".  (Odd that you used underlines instead of spaces.)

> exiftool t/images/ -if '$author =~ /phil/i' -none
======== t/images/AIFF.aif
======== t/images/DjVu.djvu
======== t/images/ExtendedXMP.jpg
======== t/images/Flash.swf
======== t/images/Real.rm
    1 directories scanned
  117 files failed condition
    5 image files read

> exiftool t/images/ -if '$author =~ /matt/i' -none
    1 directories scanned
  122 files failed condition
    0 image files read


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

mcquiff

First time round I missed out the "-"if

172-0-1-68:~ matthew$ exiftool -if '$author =~ /"matt"/i' -none -r ~/Music/2_do_Freedom_WK27/FR10NW10858OR6GO.jpg
    1 files failed condition


but this fails, open the image in preview, and it shows under exif, owner name Matthew Child



https://www.dropbox.com/sh/zvcwcdtuoxbpu18/IApilhzIYF#f:FR10NW10858OR6GO.JPG

mcquiff

OK i'm wrong again! started to add " " trying to test it

all working now!