Process ONLY if newer than...

Started by jhaneyzz, March 15, 2013, 11:28:54 AM

Previous topic - Next topic

jhaneyzz

I am using the command line below to extract data from files ONLY if their FileModifyDate is newer than 2013-01-21 12:00:00.

The command ran fine, except it did not limit the output by date.

Is there a way to construct the command in order to do this?

LCCmacMini:bin jhaney$ exiftool -T -d "%Y/%m/%d %H:%M:%S" -charset UTF8 -r -f -scanForXMP -fast2 -ext .jpg -ext .png -ext .gif -ext .tif -ext .tiff -ext .psd -ext .pdf -ext .indd -ext .ai -ext .eps -ext .mov -ext .3gp -ext .wmv -ext .flv -FileName -Directory -FileSize# -FileModifyDate -FileCreateDate -FileType -ImageWidth -ImageHeight -Format -ColorMode -Software -ModifyDate -CreatorTool -CreateDate -xmpCreateDate -xmp:DateCreated -xmp:DateTime -xmp:ModifyDate -xmp:MetadataDate -xmp:pdf:CreationDate -xmp:pdf:ModDate -xmp:DocumentID -xmp:InstanceID -xmp:DerivedFromInstanceID -xmp:DerivedFromDocumentID -xmp:OriginalDocumentID -xmp:ManifestReferenceDocumentID -xmpManifestReferenceInstanceID -xmp:CopyrightFlag -xmp:Creator -xmp:Description -xmp:Keywords -xmp:Marked -xmp:CopyrightOwner -xmp:CopyrightOwnerName -xmp:Usage -xmp:xmpRights -xmp:CopyrightStatus -Description -if '$FileModifyDate > 2013-01-21 12:00:00' "/Volumes/Archive/" >> "/Users/jhaney/dateLimitTest.txt"

Phil Harvey

Yes.  Use 'gt' (string compare) instead of '>' (integer compare).

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

jhaneyzz

I figured it was something like that, but I thought it would be best to post the code in case I was using incorrect syntax or overlooking something else.


Phil Harvey

Also, looking again at your command, you are also missing quotes around the date/time string.  Try this:

    -if '$FileModifyDate gt "2013-01-21 12:00:00"'

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

jhaneyzz

I figured that out before I ran it again. I assumed that a string would need quotes.

Glad I was right.

"Even a blind squirrel finds a nut once in a while!"