1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"en-US" xml:
lang=
"en-US">
7 * Copyright 2008-2009, Haiku. All rights reserved.
8 * Distributed under the terms of the MIT License.
11 * Humdinger <humdingerb@gmail.com>
14 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
15 <meta http-equiv=
"Content-Style-Type" content=
"text/css" />
16 <meta name=
"robots" content=
"all" />
17 <title>Attributes
</title>
18 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0" />
19 <link rel=
"stylesheet" type=
"text/css" href=
"../Haiku-doc.css" />
24 <div><span>User guide
</span></div>
29 <ul class=
"lang-menu">
30 <li class=
"now"><img src=
"../images/flags/gb.png" alt=
"" /> English
</li>
31 <li><a href=
"../ca/attributes.html"><img src=
"../images/flags/ca.png" alt=
"" />Català
</a></li>
32 <li><a href=
"../de/attributes.html"><img src=
"../images/flags/de.png" alt=
"" />Deutsch
</a></li>
33 <li><a href=
"../es/attributes.html"><img src=
"../images/flags/es.png" alt=
"" />Español
</a></li>
34 <li><a href=
"../fr/attributes.html"><img src=
"../images/flags/fr.png" alt=
"" />Français
</a></li>
35 <li><a href=
"../it/attributes.html"><img src=
"../images/flags/it.png" alt=
"" />Italiano
</a></li>
36 <li><a href=
"../hu/attributes.html"><img src=
"../images/flags/hu.png" alt=
"" />Magyar
</a></li>
37 <li><a href=
"../pl/attributes.html"><img src=
"../images/flags/pl.png" alt=
"" />Polski
</a></li>
38 <li><a href=
"../pt_PT/attributes.html"><img src=
"../images/flags/pt_PT.png" alt=
"" />Português
</a></li>
39 <li><a href=
"../pt_BR/attributes.html"><img src=
"../images/flags/pt_BR.png" alt=
"" />Português (Brazil)
</a></li>
40 <li><a href=
"../ro/attributes.html"><img src=
"../images/flags/ro.png" alt=
"" />Română
</a></li>
41 <li><a href=
"../sk/attributes.html"><img src=
"../images/flags/sk.png" alt=
"" />Slovenčina
</a></li>
42 <li><a href=
"../fi/attributes.html"><img src=
"../images/flags/fi.png" alt=
"" />Suomi
</a></li>
43 <li><a href=
"../sv_SE/attributes.html"><img src=
"../images/flags/sv_SE.png" alt=
"" />Svenska
</a></li>
44 <li><a href=
"../zh_CN/attributes.html"><img src=
"../images/flags/zh_CN.png" alt=
"" /> 中文 [中文]
</a></li>
45 <li><a href=
"../ru/attributes.html"><img src=
"../images/flags/ru.png" alt=
"" />Русский
</a></li>
46 <li><a href=
"../uk/attributes.html"><img src=
"../images/flags/uk.png" alt=
"" />Українська
</a></li>
47 <li><a href=
"../jp/attributes.html"><img src=
"../images/flags/jp.png" alt=
"" />日本語
</a></li>
50 «
<a href=
"filetypes.html">Filetypes
</a>
51 ::
<a href=
"contents.html" class=
"uplink">Contents
</a>
52 ::
<a href=
"index.html">Index
</a> »
61 <p>Attributes are data fields that belong to a file but aren't part of that file, e.g. they are not computed into the file size and can be copied or changed without touching the file itself. The system uses these attributes to store e.g. file size, file type or date of the last modification. This is similar to other operating systems and their filesystems.
</p>
62 <p>What's different is that you can add any kind of attribute to any file and display it or make it editable in a Tracker window. You just have to define the kind of attribute you want to add to a file type (e.g. string, integer or time) and give it a name and description.
</p>
63 <p>The file itself doesn't even need any contents at all. Take a look at these People files for example:
</p>
64 <img src=
"images/attributes-images/people.png" alt=
"people.png" />
66 <p>As you can see, these are all
0-sized files with attached attributes, the E-mail attribute of
"John Nox" being edited right in Tracker.
</p>
67 <p>If you index these attributes, as People, Email or audio files are by default, they are also searchable with Haiku's fast query system.
</p>
70 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
71 <a id=
"attributes-tracker" name=
"attributes-tracker">Attributes in Tracker
</a></h2>
72 <p>Attributes are displayed quite similar to a database or spreadsheet. Using Tracker you can choose which attributes to display (columns) and sort file listings (rows) accordingly.
</p>
73 <p>To do this, open a Tracker window, click on the
<span class=
"menu">Attributes
</span> menu, and select the attributes you want to display. Alternatively, simply right-click onto a column heading and mark the items in the context menu. You can rearrange the columns by a simple drag
&drop of the column heading. Moving a column out of a window, is a fast way to get rid of columns you don't need.
</p>
74 <p>Double-click on the line between two attributes in the heading to automatically resize a column to its optimal width.
</p>
75 <p>Click on a column heading to toggle the sorting order from ascending to descending. You can establish a secondary sort order by pressing the
<span class=
"key">SHIFT
</span> key while clicking on a column heading. You can sort your People files by company and within that order sort by contact name, for instance. See the above screenshot as an example. The secondary sort order is marked by a lighter colored indicator beside the heading.
</p>
76 <p>Editing these attributes is as simple as renaming a file: Either click on an entry or press
<span class=
"key">ALT
</span> <span class=
"key">E
</span> and move between the attributes with
<span class=
"key">TAB
</span> and
<span class=
"key">SHIFT
</span> <span class=
"key">TAB
</span>.
<span class=
"key">ESC
</span> leaves the editing mode without applying the changes.
</p>
79 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
80 <a id=
"attributes-terminal" name=
"attributes-terminal">Attributes in Terminal
</a></h2>
81 <p>If you prefer to use the commandline or plan to work with many files using scripting, there are several commands for controlling attributes from Terminal.
</p>
83 <a href=
"#"><img src=
"../images/up.png" style=
"border:none;float:right" alt=
"index" /></a>
84 <a id=
"listattr" name=
"listattr">listattr
</a></h3>
85 <p><span class=
"cli">listattr
</span> lists a file's attributes, but doesn't show the contents of the attributes.
</p>
86 <pre>usage: listattr 'filename' ['filename' ...]
</pre>
87 <p>From our screenshot example above:
</p>
88 <pre class=
"terminal"> ~/people -
>listattr Clara\ Botters
91 ----------- --------- -------------------------------
92 MIME String
21 "BEOS:TYPE"
94 Text
6 "META:nickname"
97 Text
18 "META:address"
101 Text
1 "META:country"
104 Text
13 "META:wphone"
110 Raw Data
20 "_trk/pinfo_le"
112 131 bytes total in attributes.
</pre>
113 <p>Besides all the
"<tt>META:*</tt>" attributes that hold the contact's information, there are two attributes that are managed by the system:
</p>
115 <li><p><tt>BEOS:TYPE
</tt> holds the file type as a
<acronym title=
"Multipurpose Internet Mail Extensions">MIME
</acronym> string, here
"<tt>application/x-person</tt>". It determines the default icon and the application that opens the file when you e.g. double click it.
</p></li>
116 <li><p>"<tt>_trk/pinfo_le</tt>" is the attribute with which Tracker keeps track of a file's icon position.
</p></li></ul>
117 <div class=
"box-info">Note the backslash after
"Clara". In Terminal you have to
"escape" special characters like
<tt>'
"*\$?!</tt>. The space between "Clara
" and "Botters
" is also one of those. Therefore the backslash is really in front of the space character, and not after "Clara
".</div>
120 <a href="#
"><img src="../images/up.png
" style="border:none;float:right
" alt="index
" /></a>
121 <a id="catattr
" name="catattr
">catattr</a></h3>
122 <p><span class="cli
">catattr</span> displays the contents of a specific attribute of a file.</p>
123 <pre>usage: catattr [--raw|-r] attr_name file1 [file2...]</pre>
124 <p>Again our example:</p>
125 <pre class="terminal
"> ~/people ->catattr META:city Clara\ Botters
126 Clara Botters : string : Whelton</pre>
129 <a href="#
"><img src="../images/up.png
" style="border:none;float:right
" alt="index
" /></a>
130 <a id="addattr
" name="addattr
">addattr</a></h3>
131 <p><span class="cli
">addattr</span> adds an attribute to a file and/or fills it with a value.</p>
132 <pre>usage: addattr [-t type] attr value file1 [file2...]
133 or: addattr [-f value-from-file] [-t type] attr file1 [file2...]
136 string, mime, int, llong, float, double, bool, icon, raw
137 or a numeric value (ie. 0x1234, 42, 'ABCD', ...)
138 The default is "string
"</pre>
139 <p>So, say dear Clara took a job with the multi-national Barkelbaer Inc., you fill the formerly empty "Company
" attribute with that data (which is of type "string
"):</p>
140 <pre class="terminal
"> ~/people ->addattr -t string META:company Barkelbaer\ Inc. Clara\ Botters</pre>
143 <a href="#
"><img src="../images/up.png
" style="border:none;float:right
" alt="index
" /></a>
144 <a id="rmattr
" name="rmattr
">rmattr</a></h3>
145 <p><span class="cli
">rmattr</span> completely removes an attribute from a file.</p>
147 <pre>usage: rmattr [-p] attr filename1 [filename2...]
148 'attr' is the name of an attribute of the file
149 If '-p' is specified, 'attr' is regarded as a pattern.</pre>
150 <p>Though in all practicality it would be enough to just not fill the "Fax
" attribute, you can completely remove it from Clara's file by typing:</p>
151 <pre class="terminal
"> ~/people ->rmattr META:fax Clara\ Botters</pre>
154 <a href="#
"><img src="../images/up.png
" style="border:none;float:right
" alt="index
" /></a>
155 <a id="copyattr
" name="copyattr
">copyattr</a></h3>
156 <p><span class="cli
">copyattr</span> copies attributes from one or more files to another. By default, the actual contents of the file is <b>not</b> copied.</p>
157 <pre>Usage: copyattr <options> <source> [ ... ] <destination></pre>
159 <p>If you do want to copy the attributes plus the data of the file itself, you can add the option "<span class=
"cli">-d
</span>" or "<span class=
"cli">--data
</span>".</p>
162 <p>More information on these commands and their options can be found by typing the command name followed by "<span class=
"cli">-h
</span>" or "<span class=
"cli">--help
</span>".</p>
168 <div class="inner
"><span>
169 « <a href="filetypes.html
">Filetypes</a>
170 :: <a href="contents.html
" class="uplink
">Contents</a>
171 :: <a href="index.html
">Index</a> »