selecting all read only files?

Started by AlainD, April 06, 2017, 04:57:13 AM

Previous topic - Next topic

AlainD

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

Phil Harvey

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

AlainD

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

Phil Harvey

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