Filename filters wildcards and directory recursing

Started by andyew, August 08, 2017, 02:27:53 AM

Previous topic - Next topic

andyew

Folks,
I'm a DOS user from way back which is why this is a bit frustrating and embarrassing.

I'm clearly using an incorrect search criteria or it's such simple thing that I'm missing a fundamental understanding.

What I want to do is get the image filename and the createdate from a bunch of JPGs in a number of sub-directories into a file.

This is what I have
exiftool -r -csv -filename -d "%Y%m%d%H%m%S" -createdate . -ext jpg>output.csv

To be honest this works well enough although I get the subdirectory path as well because of the -r but if omit the -r it's stops recursing. However my real problem is I've found a few images being picked up that have nothing to do with what I'm doing.

Fortunately all of my target images are DSC*.jpg pattern.

For the life of me I can't find a way to apply a criteria to the command line that only picks up the "DSC*.jpg" file names.

I have read the "." and -r essentially work hand in hand and *.* is a problem but I can't find the solution.

Advice greatly appreciated.

Phil Harvey

I can't think of an easy way to do this if recursing subdirectories using any DOS feature.

But you can use the ExifTool -if option to do it:

exiftool -r -csv -filename -d "%Y%m%d%H%m%S" -createdate . -ext jpg -if "$filename =~ /^DSC/" >output.csv

If you don't want the SourceFile column, then you could do this:

exiftool -r -p "$filename,$creatdate" -d "%Y%m%d%H%m%S" . -ext jpg -if "$filename =~ /^DSC/" >output.csv

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

andyew

Thanks Phil,
The latter is exactly what I'm after. I was wondering if "-if" was the right answer.

Thanks again.