ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: AlainD on April 06, 2017, 04:57:13 AM

Title: selecting all read only files?
Post by: AlainD on April 06, 2017, 04:57:13 AM
Hi

My Nikon camera has the possibility to "select" files, which means they are marked read only.
It would be nice to have an option to run exiftool on all read only files.  (This is usually about 1 file in 10 when I use the feature)

Alain
Title: Re: selecting all read only files?
Post by: Phil Harvey on April 06, 2017, 07:05:29 AM
Hi Alain,

You can do something like this:

exiftool -if "$filepermissions=~/^.-......./" DIR

Here I am checking the file permissions to see if there is a "-" in the place of the owner write permission.  The "." matches anything.  Replace any of the dots with the permissions you are looking for.

- Phil
Title: Re: selecting all read only files?
Post by: AlainD on April 06, 2017, 07:19:56 PM
Hi Phil

Thanks for the very fast and specific answer.

Is it correct that the if is only checked after that the tags are read?  If  I add the if statement only the read-only files are in the output, but it seems to take as long as outputting all the files.

used command (on +1000 files on a SSD):

exiftool  -fast2 -n -if "$filepermissions=~/^.-......./" -T -filename -SubSecCreateDate    X:\foto_test  >result5.txt
Title: Re: selecting all read only files?
Post by: Phil Harvey on April 07, 2017, 07:30:35 AM
Ah, yes.  The entire file is read to evaluate the -if condition.  So you are right, this will be slow.  How about a 2-step process like this?:

1. exiftool -fast3 -if "$filepermissions=~/^.-......./" -p "$directory/$filename" > files.txt

2. exiftool -filename -SubSecCreateDate -@ files.txt

- Phil