changing file attributes

juggernot

Well-known member
Joined
Sep 28, 2006
Messages
173
Programming Experience
Beginner
I'm trying to set the attributes of a file, but It seems I can only make one attribute change at a time, and the last attribute change is the only one that counts(It resets my previous attribute changes). I've tried using setattr and file.settattributes, but both don't seem to work for me. Basically my question is, how do I change more than one file attribute at a time?
 
You manipulate file attributes with bitwise operators, the one to add two attributes is Or. See the example in documentation for File.SetAttributes Method
 
Thanks for the help. That works perfectly. Though I am a little confused, why is it or? Wouldn't and make more sense?
 
Bitwise operator Or performs a logical disjunction, And operator a conjunction. This is the appropriate keywords for those logical operations. The bits of the two expressions are changed according to the logical rules. Have a go at Wiki about this: http://en.wikipedia.org/wiki/Bitwise_operation
The theory of logical maths date way back to the ancient greeks and famous Aristotle. Once you gain the basic knowledge you will no longer be confused by these logic laws.
 
Back
Top