Main Menu

Again hidden files

Started by herb, March 22, 2020, 04:06:17 AM

Previous topic - Next topic

herb

Hello Phil,

Till now I used the following command to avoid that Exiftool does modify hidden files:
exiftool -api systemtags -if not "$fileattributes=~/Hidden/" -exampletag=examplevalue -ext jpg DIR
But this has some disadvantage for me, because it depends on used language ( e.g.: -lang de ) and it depends on option -n.

So I created an user-defined composite tag
IsHiddenReadonly => {
   Require => 'FileAttributes',     # needs also -api systemtags
   ValueConv => q{
         my @parts = split ' ', $val;           # format of fileattributes is inta intb intc
         # on windows intc: bit1=readonly bit2=hidden
         my $sign = $parts[2];
         $sign &= 3;                           # only these bits: hidden and readonly
         return $sign;
     },
},

and instead of the above given command I use the following
exiftool -api systemtags -if not "$fileattributes=~/23/" -exampletag=examplevalue -ext jpg DIR
The option -api systemtags is not moved into the config file, because I do not always work with hidden files.
Atleast on Windows it is working perfect for me.


Best regards
Herb

Phil Harvey

Hi Herb,

I don't understand this:

"$fileattributes=~/23/"

First, I thought you should be testing IsHiddenReadonly, not FileAttributes.

Second, the IsHiddenReadonlly value should never contain the string "23" because you have done "&= 3" to remove all bits but 0 and 1.

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

herb

Hello Phil,

yes you are right; the copy & past gremlin was here.
The command has to be
exiftool -api systemtags -if not "$IsHiddenReadonly=~/2|3/" -exampletag=examplevalue -ext jpg DIR

Hoping all is ok now
Best regards
Herb

Phil Harvey

#3
Hi Herb,

Without the config file, I think this would do the same thing:

exiftool -api systemtags -if "not ($fileattributes#=~/^\S+ \S+ (\d+)$/ and $1 & 0x02)" -exampletag=examplevalue -ext jpg DIR

- Phil

Edit: Oops.  "not" must be inside the quotes.
...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 ($).