Attributes String from File

Article Tools

file attributes are like switches. If the switch for Hidden is on, the file is a hidden file. If the switch for Hidden is off, the file is not a hidden file.
This analogy can be carried further by noting that light switches are typically under your control: you can choose to turn them on, or you can choose to turn them off.
In this QTip we are going to write a generic function that would retrieve a folder attributes as a string abbreviation.

 

image

File Attributes

  • A file attribute is metadata that describes or is associated with a computer file.
  • For example, an operating system often keeps track of date a file was created and last modified, as well as the file’s size and extension (and what application to open it with).
  • File permissions are also kept track of. The user may attach other attributes themselves.

image

image

  • A bitmap is like a set of switches that can be either on or off.
  • If a particular switch is off, that switch has the value 0.
  • If the switch is on, at least in the case of a folder object, it has one of the values shown in the attributes the value of the bitmap is equal to the sum of all the switches.
  • Directory has the value 16.
  • Because the other switches are off, each has the value 0.
  • The total value for the bitmap is thus 16. If you queried the Attributes value for this folder, the script would return 16.

 

image

The Function

image

image

image

image

image

Examples

image image

image image

 

Previous postComplex Dictionary Usage Next postInternationalization

Related Posts

Post Your Comment

You must be logged in to post a comment.