"Bob Landau" <BobLandau@xxxxxx> wrote in message
news:6CE1A1EC-2FF8-4CE9-A6A6-593EDF30EC0E@xxxxxx
Quote:
>I wasn't aware directories would never have the archive bit set but they
>can
> have read, hidden and system (c:\windows\assembly is one of many
> directories
> other attributes set.
>
> At least one reason that it's convoluted is to keep compatibility with how
> "CMD /C DIR" processes attribues. This will not work.
>
> ($_.Attributes -band 33) -eq 33
Have you tested it?
Quote:
> because DIR only cares whether these attributes are set or not. For
> instance
> if all I want is the Readonly/System files in the Windows directory it
> will
> return any files that have these bits set. Any other attribute can also
> be
> set and it will still be consider a match so equality can't be used.
Yes it can. I am not testing Attributes as being equal to 33, I am testing
the value as having "at least" the bits that make 33 as a combination of
possible attributes. If a file has other attributes it will also be
recognised as positive to the match.
Does that make sense?
Jacques