File: qdir.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (374 lines) | stat: -rw-r--r-- 54,910 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDir Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDir Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QDir class provides access to directory structures and their contents. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qdir.html#Filter-enum">Filter</a></b> { Dirs, Files, Drives, NoSymLinks, ..., NoFilter }</li><li><div class="fn" />class <b><a href="qdir-filters.html">Filters</a></b></li><li><div class="fn" />enum <b><a href="qdir.html#SortFlag-enum">SortFlag</a></b> { Name, Time, Size, Unsorted, ..., NoSort }</li><li><div class="fn" />class <b><a href="qdir-sortflags.html">SortFlags</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdir.html#QDir">__init__</a></b> (<i>self</i>, QDir)</li><li><div class="fn" /><b><a href="qdir.html#QDir-2">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>&#160;=&#160;QString())</li><li><div class="fn" /><b><a href="qdir.html#QDir-3">__init__</a></b> (<i>self</i>, QString&#160;<i>path</i>, QString&#160;<i>nameFilter</i>, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir::SortFlags(QDir.Name | QDir.IgnoreCase), Filters&#160;<i>filter</i>&#160;=&#160;QDir.TypeMask)</li><li><div class="fn" />QString <b><a href="qdir.html#absoluteFilePath">absoluteFilePath</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#absolutePath">absolutePath</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#canonicalPath">canonicalPath</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#cd">cd</a></b> (<i>self</i>, QString&#160;<i>dirName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#cdUp">cdUp</a></b> (<i>self</i>)</li><li><div class="fn" />unsigned long <b><a href="qdir.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#dirName">dirName</a></b> (<i>self</i>)</li><li><div class="fn" />QFileInfo-list <b><a href="qdir.html#entryInfoList">entryInfoList</a></b> (<i>self</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />QFileInfo-list <b><a href="qdir.html#entryInfoList-2">entryInfoList</a></b> (<i>self</i>, QStringList&#160;<i>nameFilters</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />QStringList <b><a href="qdir.html#entryList">entryList</a></b> (<i>self</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />QStringList <b><a href="qdir.html#entryList-2">entryList</a></b> (<i>self</i>, QStringList&#160;<i>nameFilters</i>, Filters&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, SortFlags&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</li><li><div class="fn" />bool <b><a href="qdir.html#exists">exists</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#exists-2">exists</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#filePath">filePath</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />Filters <b><a href="qdir.html#filter">filter</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isAbsolute">isAbsolute</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isReadable">isReadable</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isRelative">isRelative</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isRoot">isRoot</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#makeAbsolute">makeAbsolute</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#mkdir">mkdir</a></b> (<i>self</i>, QString&#160;<i>dirName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#mkpath">mkpath</a></b> (<i>self</i>, QString&#160;<i>dirPath</i>)</li><li><div class="fn" />QStringList <b><a href="qdir.html#nameFilters">nameFilters</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#path">path</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdir.html#refresh">refresh</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#relativeFilePath">relativeFilePath</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#remove">remove</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#rename">rename</a></b> (<i>self</i>, QString&#160;<i>oldName</i>, QString&#160;<i>newName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#rmdir">rmdir</a></b> (<i>self</i>, QString&#160;<i>dirName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#rmpath">rmpath</a></b> (<i>self</i>, QString&#160;<i>dirPath</i>)</li><li><div class="fn" /><b><a href="qdir.html#setFilter">setFilter</a></b> (<i>self</i>, Filters&#160;<i>filter</i>)</li><li><div class="fn" /><b><a href="qdir.html#setNameFilters">setNameFilters</a></b> (<i>self</i>, QStringList&#160;<i>nameFilters</i>)</li><li><div class="fn" /><b><a href="qdir.html#setPath">setPath</a></b> (<i>self</i>, QString&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qdir.html#setSorting">setSorting</a></b> (<i>self</i>, SortFlags&#160;<i>sort</i>)</li><li><div class="fn" />SortFlags <b><a href="qdir.html#sorting">sorting</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qdir.html#addResourceSearchPath">addResourceSearchPath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#cleanPath">cleanPath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#convertSeparators">convertSeparators</a></b> (QString&#160;<i>pathName</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#current">current</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#currentPath">currentPath</a></b> ()</li><li><div class="fn" />QFileInfo-list <b><a href="qdir.html#drives">drives</a></b> ()</li><li><div class="fn" />QDir <b><a href="qdir.html#home">home</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#homePath">homePath</a></b> ()</li><li><div class="fn" />bool <b><a href="qdir.html#isAbsolutePath">isAbsolutePath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#isRelativePath">isRelativePath</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#match">match</a></b> (QStringList&#160;<i>filters</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#match-2">match</a></b> (QString&#160;<i>filter</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />QStringList <b><a href="qdir.html#nameFiltersFromString">nameFiltersFromString</a></b> (QString&#160;<i>nameFilter</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#root">root</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#rootPath">rootPath</a></b> ()</li><li><div class="fn" />QChar <b><a href="qdir.html#separator">separator</a></b> ()</li><li><div class="fn" />bool <b><a href="qdir.html#setCurrent">setCurrent</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" />QDir <b><a href="qdir.html#temp">temp</a></b> ()</li><li><div class="fn" />QString <b><a href="qdir.html#tempPath">tempPath</a></b> ()</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />int <b><a href="qdir.html#__contains__">__contains__</a></b> (<i>self</i>, QString)</li><li><div class="fn" />bool <b><a href="qdir.html#__eq__">__eq__</a></b> (<i>self</i>, QDir&#160;<i>dir</i>)</li><li><div class="fn" />QString <b><a href="qdir.html#__getitem__">__getitem__</a></b> (<i>self</i>, int)</li><li><div class="fn" />QStringList <b><a href="qdir.html#__getitem__-2">__getitem__</a></b> (<i>self</i>, slice)</li><li><div class="fn" />int <b><a href="qdir.html#__len__">__len__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdir.html#__ne__">__ne__</a></b> (<i>self</i>, QDir&#160;<i>dir</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDir class provides access to directory structures and their contents.</p>
<p>A QDir is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system. It can also be used to access Qt's <a href="resources.html#resource-system">resource system</a>.</p>
<p>A QDir can point to a file using either a relative or an absolute path. Absolute paths begin with the directory separator "/" (optionally preceded by a drive specification under Windows). If you always use "/" as a directory separator, Qt will translate your paths to conform to the underlying operating system. Relative file names begin with a directory name or a file name and specify a path relative to the current directory.</p>
<p>An example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib". You can use the <a href="qdir.html#isRelative">isRelative</a>() or <a href="qdir.html#isAbsolute">isAbsolute</a>() functions to check if a QDir is using a relative or an absolute file path. Call <a href="qdir.html#makeAbsolute">makeAbsolute</a>() to convert a relative QDir to an absolute one. For a simplified path use <a href="qdir.html#cleanPath">cleanPath</a>(). To obtain a path which has no symbolic links or redundant ".." elements use <a href="qdir.html#canonicalPath">canonicalPath</a>(). The path can be set with <a href="qdir.html#setPath">setPath</a>(), and changed with <a href="qdir.html#cd">cd</a>() and <a href="qdir.html#cdUp">cdUp</a>().</p>
<p>The <a href="qdir.html#current">current</a>() path (and <a href="qdir.html#currentPath">currentPath</a>()), refers to the application's working directory. A QDir's own path is set and retrieved with <a href="qdir.html#setPath">setPath</a>() and <a href="qdir.html#path">path</a>().</p>
<p>QDir provides several static convenience functions, for example, <a href="qdir.html#setCurrent">setCurrent</a>() to set the application's working directory and <a href="qdir.html#current">current</a>() and <a href="qdir.html#currentPath">currentPath</a>() to retrieve the application's working directory. Access to some common paths is provided with the static functions, <a href="qdir.html#home">home</a>(), <a href="qdir.html#root">root</a>(), and <a href="qdir.html#temp">temp</a>() which return QDir objects or <a href="qdir.html#homePath">homePath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>() which return the path as a string. For the application's directory, see <a href="qcoreapplication.html#applicationDirPath">QApplication.applicationDirPath</a>().</p>
<p>The number of entries in a directory is returned by <a href="qdir.html#count">count</a>(). You can obtain a string list of the names of all the files and directories in a directory with <a href="qdir.html#entryList">entryList</a>(). If you prefer a list of <a href="qfileinfo.html">QFileInfo</a> pointers use <a href="qdir.html#entryInfoList">entryInfoList</a>(). Both these functions can apply a name filter, an attributes filter (e.g. read-only, files not directories, etc.), and a sort order. The filters and sort may be set with calls to <a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setFilter">setFilter</a>() and <a href="qdir.html#setSorting">setSorting</a>(). They may also be specified in the <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>()'s arguments. You can test to see if a filename matches a filter using <a href="qdir.html#match">match</a>().</p>
<p>Create a new directory with <a href="qdir.html#mkdir">mkdir</a>(), rename a directory with <a href="qdir.html#rename">rename</a>() and remove an existing directory with <a href="qdir.html#rmdir">rmdir</a>(). Remove a file with <a href="qdir.html#remove">remove</a>(). You can query a directory with <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#isReadable">isReadable</a>(), <a href="qdir.html#isAbsolute">isAbsolute</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#isRoot">isRoot</a>(). You can use <a href="qdir.html#refresh">refresh</a>() to re-read the directory's data from disk.</p>
<p>To get a path with a filename use <a href="qdir.html#filePath">filePath</a>(), and to get a directory name use <a href="qdir.html#dirName">dirName</a>(); neither of these functions checks for the existence of the file or directory. The <a href="qdir.html#path">path</a>() (changeable with <a href="qdir.html#setPath">setPath</a>()), <a href="qdir.html#absolutePath">absolutePath</a>(), <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>() are also available.</p>
<p>The list of root directories is provided by <a href="qdir.html#drives">drives</a>(); on Unix systems this returns a list containing a single root directory, "/"; on Windows the list will usually contain "C:/", and possibly "D:/", etc.</p>
<p>It is easiest to work with "/" separators in Qt code. If you need to present a path to the user or need a path in a form suitable for a function in the underlying operating system use <a href="qdir.html#convertSeparators">convertSeparators</a>().</p>
<p>Example (check if a directory exists):</p>
<pre>
    QDir dir("example");
    if (!dir.exists())
        qWarning("Cannot find the example directory");
</pre>
<p>(We could also use the static convenience function <a href="qfile.html#exists">QFile.exists</a>().)</p>
<p>Example (traversing directories and reading a file):</p>
<pre>
    QDir dir = QDir.root();                 // "/"
    if (!dir.cd("tmp")) {                    // "/tmp"
        qWarning("Cannot find the \"/tmp\" directory");
    } else {
        QFile file(dir.filePath("ex1.txt")); // "/tmp/ex1.txt"
        if (!file.open(QIODevice.ReadWrite))
            qWarning("Cannot create the file %s", file.name());
    }
</pre>
<p>A program that lists all the files in the current directory (excluding symbolic links), sorted by size, smallest first:</p>
<pre>
    #include &lt;QDir&gt;

    #include &lt;stdio.h&gt;

    int main(int argc, char *argv[])
    {
        QDir dir;
        dir.setFilter(QDir.Files | QDir.Hidden | QDir.NoSymLinks);
        dir.setSorting(QDir.Size | QDir.Reversed);

        QFileInfoList list = dir.entryInfoList();
        printf("     Bytes Filename\n");
        for (int i = 0; i &lt; list.size(); ++i) {
            QFileInfo fileInfo = list.at(i);
            printf("%10li %s\n", fileInfo.size(), qPrintable(fileInfo.fileName()));
        }
        return 0;
    }
</pre>
<p>See also <a href="qfileinfo.html">QFileInfo</a>, <a href="qfile.html">QFile</a>, and <a href="qcoreapplication.html#applicationDirPath">QApplication.applicationDirPath</a>().</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Filter-enum" />QDir.Filter</h3><p>This enum describes the filtering options available to <a href="qdir.html">QDir</a>; e.g. for <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>(). The filter value is specified by combining values from the following list using the bitwise OR operator:</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QDir.Dirs</tt></td>
<td align="center" valign="top"><tt>0x001</tt></td>
<td valign="top">List directories that match the filters.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.AllDirs</tt></td>
<td align="center" valign="top"><tt>0x400</tt></td>
<td valign="top">List all directories; i.e. don't apply the filters to directory names.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Files</tt></td>
<td align="center" valign="top"><tt>0x002</tt></td>
<td valign="top">List files only.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Drives</tt></td>
<td align="center" valign="top"><tt>0x004</tt></td>
<td valign="top">List disk drives (ignored under Unix).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.NoSymLinks</tt></td>
<td align="center" valign="top"><tt>0x008</tt></td>
<td valign="top">Do not list symbolic links (ignored by operating systems that don't support symbolic links).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.NoDotAndDotDot</tt></td>
<td align="center" valign="top"><tt>0x1000</tt></td>
<td valign="top">Do not list the special entries "." and "..".</td>
</tr>
<tr>
<td valign="top"><tt>QDir.AllEntries</tt></td>
<td align="center" valign="top"><tt>Dirs | Files | Drives</tt></td>
<td valign="top">List directories, files, drives and symlinks (this does not list broken symlinks unless you specify System).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Readable</tt></td>
<td align="center" valign="top"><tt>0x010</tt></td>
<td valign="top">List files for which the application has read access.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Writable</tt></td>
<td align="center" valign="top"><tt>0x020</tt></td>
<td valign="top">List files for which the application has write access.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Executable</tt></td>
<td align="center" valign="top"><tt>0x040</tt></td>
<td valign="top">List files for which the application has execute access. Executables needs to be combined with Dirs or Files.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Modified</tt></td>
<td align="center" valign="top"><tt>0x080</tt></td>
<td valign="top">Only list files that have been modified (ignored under Unix).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Hidden</tt></td>
<td align="center" valign="top"><tt>0x100</tt></td>
<td valign="top">List hidden files (on Unix, files starting with a .).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.System</tt></td>
<td align="center" valign="top"><tt>0x200</tt></td>
<td valign="top">List system files (on Unix, FIFOs, sockets and device files)</td>
</tr>
<tr>
<td valign="top"><tt>QDir.CaseSensitive</tt></td>
<td align="center" valign="top"><tt>0x800</tt></td>
<td valign="top">The filter should be case sensitive if the file system is case sensitive.</td>
</tr>
</table>
<br />
<br />
<p>Functions that use Filter enum values to filter lists of files and directories will include symbolic links to files and directories unless you set the NoSymLinks value.</p>
<p>A default constructed <a href="qdir.html">QDir</a> will not filter out files based on their permissions, so <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() will return all files that are readable, writable, executable, or any combination of the three. This makes the default easy to write, and at the same time useful.</p>
<p>For example, setting the <tt>Readable</tt>, <tt>Writable</tt>, and <tt>Files</tt> flags allows all files to be listed for which the application has read access, write access or both. If the <tt>Dirs</tt> and <tt>Drives</tt> flags are also included in this combination then all drives, directories, all files that the application can read, write, or execute, and symlinks to such files/directories can be listed.</p>
<p>To retrieve the permissons for a directory, use the <a href="qdir.html#entryInfoList">entryInfoList</a>() function to get the associated <a href="qfileinfo.html">QFileInfo</a> objects and then use the QFileInfo.permissons() to obtain the permissions and ownership for each file.</p>
<p>The Filters type is a typedef for <a href="qflags.html">QFlags</a>&lt;Filter&gt;. It stores an OR combination of Filter values.</p>
<h3 class="fn"><a name="SortFlag-enum" />QDir.SortFlag</h3><p>This enum describes the sort options available to <a href="qdir.html">QDir</a>, e.g. for <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>(). The sort value is specified by OR-ing together values from the following list:</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QDir.Name</tt></td>
<td align="center" valign="top"><tt>0x00</tt></td>
<td valign="top">Sort by name.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Time</tt></td>
<td align="center" valign="top"><tt>0x01</tt></td>
<td valign="top">Sort by time (modification time).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Size</tt></td>
<td align="center" valign="top"><tt>0x02</tt></td>
<td valign="top">Sort by file size.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Type</tt></td>
<td align="center" valign="top"><tt>0x80</tt></td>
<td valign="top">Sort by file type (extension).</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Unsorted</tt></td>
<td align="center" valign="top"><tt>0x03</tt></td>
<td valign="top">Do not sort.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.DirsFirst</tt></td>
<td align="center" valign="top"><tt>0x04</tt></td>
<td valign="top">Put the directories first, then the files.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.DirsLast</tt></td>
<td align="center" valign="top"><tt>0x20</tt></td>
<td valign="top">Put the files first, then the directories.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.Reversed</tt></td>
<td align="center" valign="top"><tt>0x08</tt></td>
<td valign="top">Reverse the sort order.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.IgnoreCase</tt></td>
<td align="center" valign="top"><tt>0x10</tt></td>
<td valign="top">Sort case-insensitively.</td>
</tr>
<tr>
<td valign="top"><tt>QDir.LocaleAware</tt></td>
<td align="center" valign="top"><tt>0x40</tt></td>
<td valign="top">Sort items appropriately using the current locale settings.</td>
</tr>
</table>
<br />
<br />
<p>You can only specify one of the first four.</p>
<p>If you specify both DirsFirst and Reversed, directories are still put first, but in reverse order; the files will be listed after the directories, again in reverse order.</p>
<p>The SortFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;SortFlag&gt;. It stores an OR combination of SortFlag values.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDir" />QDir.__init__ (<i>self</i>, <a href="qdir.html">QDir</a>)</h3><p>Constructs a <a href="qdir.html">QDir</a> object that is a copy of the <a href="qdir.html">QDir</a> object for directory <i>dir</i>.</p>
<p>See also <a href="qdir.html#operator-eq">operator=</a>().</p>
<h3 class="fn"><a name="QDir-2" />QDir.__init__ (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>path</i>&#160;=&#160;QString())</h3><p>Constructs a <a href="qdir.html">QDir</a> pointing to the given directory <i>path</i>. If path is empty the program's working directory, ("."), is used.</p>
<p>See also <a href="qdir.html#currentPath">currentPath</a>().</p>
<h3 class="fn"><a name="QDir-3" />QDir.__init__ (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>path</i>, <a href="qstring.html">QString</a>&#160;<i>nameFilter</i>, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir::SortFlags(QDir.Name | QDir.IgnoreCase), <a href="qdir-filters.html">Filters</a>&#160;<i>filter</i>&#160;=&#160;QDir.TypeMask)</h3><p>Constructs a <a href="qdir.html">QDir</a> with path <i>path</i>, that filters its entries by name using <i>nameFilter</i> and by attributes using <i>filters</i>. It also sorts the names using <i>sort</i>.</p>
<p>The default <i>nameFilter</i> is an empty string, which excludes nothing; the default <i>filters</i> is <a href="qdir.html#Filter-enum">AllEntries</a>, which also means exclude nothing. The default <i>sort</i> is <a href="qdir.html#SortFlag-enum">Name</a> | <a href="qdir.html#SortFlag-enum">IgnoreCase</a>, i.e. sort by name case-insensitively.</p>
<p>If <i>path</i> is an empty string, <a href="qdir.html">QDir</a> uses "." (the current directory). If <i>nameFilter</i> is an empty string, <a href="qdir.html">QDir</a> uses the name filter "*" (all files).</p>
<p>Note that <i>path</i> need not exist.</p>
<p>See also <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#setPath">setPath</a>(), <a href="qdir-qt3.html#setNameFilter">setNameFilter</a>(), <a href="qdir.html#setFilter">setFilter</a>(), and <a href="qdir.html#setSorting">setSorting</a>().</p>
<h3 class="fn"><a name="absoluteFilePath" /><a href="qstring.html">QString</a> QDir.absoluteFilePath (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>fileName</i>)</h3><p>Returns the absolute path name of a file in the directory. Does <i>not</i> check if the file actually exists in the directory; but see <a href="qdir.html#exists">exists</a>(). Redundant multiple separators or "." and ".." directories in <i>fileName</i> are not removed (see <a href="qdir.html#cleanPath">cleanPath</a>()).</p>
<p>See also <a href="qdir.html#relativeFilePath">relativeFilePath</a>(), <a href="qdir.html#filePath">filePath</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>
<h3 class="fn"><a name="absolutePath" /><a href="qstring.html">QString</a> QDir.absolutePath (<i>self</i>)</h3><p>Returns the absolute path (a path that starts with "/" or with a drive specification), which may contain symbolic links, but never contains redundant ".", ".." or multiple separators.</p>
<p>See also <a href="qdir.html#setPath">setPath</a>(), <a href="qdir.html#canonicalPath">canonicalPath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), and <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>().</p>
<h3 class="fn"><a name="addResourceSearchPath" />QDir.addResourceSearchPath (<a href="qstring.html">QString</a>&#160;<i>path</i>)</h3><p>Adds <i>path</i> to the search paths searched in to find resources that are not specified with an absolute path. The default search path is to search only in the root (<tt>:/</tt>).</p>
<p>See also <a href="resources.html">The Qt Resource System</a>.</p>
<h3 class="fn"><a name="canonicalPath" /><a href="qstring.html">QString</a> QDir.canonicalPath (<i>self</i>)</h3><p>Returns the canonical path, i.e. a path without symbolic links or redundant "." or ".." elements.</p>
<p>On systems that do not have symbolic links this function will always return the same string that <a href="qdir.html#absolutePath">absolutePath</a>() returns. If the canonical path does not exist (normally due to dangling symbolic links) canonicalPath() returns an empty string.</p>
<p>Example:</p>
<pre>
    QString bin = "/local/bin";         // where /local/bin is a symlink to /usr/bin
    QDir binDir(bin);
    QString canonicalBin = binDir.canonicalPath();
    // canonicalBin now equals "/usr/bin"

    QString ls = "/local/bin/ls";       // where ls is the executable "ls"
    QDir lsDir(ls);
    QString canonicalLs = lsDir.canonicalPath();
    // canonicalLS now equals "/usr/bin/ls".
</pre>
<p>See also <a href="qdir.html#path">path</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), and <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>().</p>
<h3 class="fn"><a name="cd" />bool QDir.cd (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>dirName</i>)</h3><p>Changes the <a href="qdir.html">QDir</a>'s directory to <i>dirName</i>.</p>
<p>Returns true if the new directory exists and is readable; otherwise returns false. Note that the logical cd() operation is not performed if the new directory does not exist.</p>
<p>Calling cd("..") is equivalent to calling <a href="qdir.html#cdUp">cdUp</a>().</p>
<p>See also <a href="qdir.html#cdUp">cdUp</a>(), <a href="qdir.html#isReadable">isReadable</a>(), <a href="qdir.html#exists">exists</a>(), and <a href="qdir.html#path">path</a>().</p>
<h3 class="fn"><a name="cdUp" />bool QDir.cdUp (<i>self</i>)</h3><p>Changes directory by moving one directory up from the <a href="qdir.html">QDir</a>'s current directory.</p>
<p>Returns true if the new directory exists and is readable; otherwise returns false. Note that the logical cdUp() operation is not performed if the new directory does not exist.</p>
<p>See also <a href="qdir.html#cd">cd</a>(), <a href="qdir.html#isReadable">isReadable</a>(), <a href="qdir.html#exists">exists</a>(), and <a href="qdir.html#path">path</a>().</p>
<h3 class="fn"><a name="cleanPath" /><a href="qstring.html">QString</a> QDir.cleanPath (<a href="qstring.html">QString</a>&#160;<i>path</i>)</h3><p>Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path, <i>path</i>.</p>
<p>Symbolic links are kept. This function does not return the canonical path, but rather the simplest version of the input. For example, "./local" becomes "local", "local/../bin" becomes "bin" and "/local/usr/../bin" becomes "/local/bin".</p>
<p>See also <a href="qdir.html#absolutePath">absolutePath</a>() and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>
<h3 class="fn"><a name="convertSeparators" /><a href="qstring.html">QString</a> QDir.convertSeparators (<a href="qstring.html">QString</a>&#160;<i>pathName</i>)</h3><p>Returns <i>pathName</i> with the '/' separators converted to separators that are appropriate for the underlying operating system.</p>
<p>On Windows, convertSeparators("c:/winnt/system32") returns "c:\winnt\system32".</p>
<p>The returned string may be the same as the argument on some operating systems, for example on Unix.</p>
<p>See also <a href="qdir.html#separator">separator</a>().</p>
<h3 class="fn"><a name="count" />unsigned long QDir.count (<i>self</i>)</h3><p>Returns the total number of directories and files in the directory.</p>
<p>Equivalent to <a href="qdir.html#entryList">entryList</a>().count().</p>
<p>See also <a href="qdir.html#operator-5b-5d">operator[]</a>() and <a href="qdir.html#entryList">entryList</a>().</p>
<h3 class="fn"><a name="current" /><a href="qdir.html">QDir</a> QDir.current ()</h3><p>Returns the absolute path of the application's current directory. See <a href="qdir.html#currentPath">currentPath</a>() for details.</p>
<p>See also <a href="qdir.html#setCurrent">setCurrent</a>(), <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#homePath">homePath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>
<h3 class="fn"><a name="currentPath" /><a href="qstring.html">QString</a> QDir.currentPath ()</h3><p>Returns the absolute path of the application's current directory.</p>
<p>See also <a href="qdir.html#current">current</a>(), <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#homePath">homePath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>
<h3 class="fn"><a name="dirName" /><a href="qstring.html">QString</a> QDir.dirName (<i>self</i>)</h3><p>Returns the name of the directory; this is <i>not</i> the same as the path, e.g. a directory with the name "mail", might have the path "/var/spool/mail". If the directory has no name (e.g. it is the root directory) an empty string is returned.</p>
<p>No check is made to ensure that a directory with this name actually exists; but see <a href="qdir.html#exists">exists</a>().</p>
<p>See also <a href="qdir.html#path">path</a>(), <a href="qdir.html#filePath">filePath</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), and <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>().</p>
<h3 class="fn"><a name="drives" />QFileInfo-list QDir.drives ()</h3><p>Returns a list of the root directories on this system. On Windows this returns a number of <a href="qfileinfo.html">QFileInfo</a> objects containing "C:/", "D:/", etc. On other operating systems, it returns a list containing just one root directory (i.e. "/").</p>
<h3 class="fn"><a name="entryInfoList" />QFileInfo-list QDir.entryInfoList (<i>self</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><p>Returns a list of <a href="qfileinfo.html">QFileInfo</a> objects for all the files and directories in the directory, ordered in accordance with <a href="qdir.html#setSorting">setSorting</a>() and filtered in accordance with <a href="qdir.html#setFilter">setFilter</a>() and <a href="qdir.html#setNameFilters">setNameFilters</a>().</p>
<p>The name filter, file attributes filter, and sorting specifications can be overridden using the <i>nameFilters</i>, <i>filters</i>, and <i>sort</i> arguments.</p>
<p>Returns an empty list if the directory is unreadable or does not exist or if nothing matches the specification.</p>
<p>See also <a href="qdir.html#entryList">entryList</a>(), <a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setSorting">setSorting</a>(), <a href="qdir.html#setFilter">setFilter</a>(), <a href="qdir.html#isReadable">isReadable</a>(), and <a href="qdir.html#exists">exists</a>().</p>
<h3 class="fn"><a name="entryInfoList-2" />QFileInfo-list QDir.entryInfoList (<i>self</i>, <a href="qstringlist.html">QStringList</a>&#160;<i>nameFilters</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><h3 class="fn"><a name="entryList" /><a href="qstringlist.html">QStringList</a> QDir.entryList (<i>self</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><p>Returns a list of the names of all the files and directories in the directory, ordered in accordance with <a href="qdir.html#setSorting">setSorting</a>() and filtered in accordance with <a href="qdir.html#setFilter">setFilter</a>() and <a href="qdir.html#setNameFilters">setNameFilters</a>().</p>
<p>The name filter, file attributes filter, and the sorting specifications can be overridden using the <i>nameFilters</i>, <i>filters</i> and <i>sort</i> arguments.</p>
<p>Returns an empty list if the directory is unreadable or does not exist or if nothing matches the specification.</p>
<p>See also <a href="qdir.html#entryInfoList">entryInfoList</a>(), <a href="qdir.html#setNameFilters">setNameFilters</a>(), <a href="qdir.html#setSorting">setSorting</a>(), and <a href="qdir.html#setFilter">setFilter</a>().</p>
<h3 class="fn"><a name="entryList-2" /><a href="qstringlist.html">QStringList</a> QDir.entryList (<i>self</i>, <a href="qstringlist.html">QStringList</a>&#160;<i>nameFilters</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filters</i>&#160;=&#160;QDir.NoFilter, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>&#160;=&#160;QDir.NoSort)</h3><h3 class="fn"><a name="exists" />bool QDir.exists (<i>self</i>)</h3><p>Returns true if the file called <i>name</i> exists; otherwise returns false.</p>
<p>See also <a href="qfileinfo.html#exists">QFileInfo.exists</a>() and <a href="qfile.html#exists">QFile.exists</a>().</p>
<h3 class="fn"><a name="exists-2" />bool QDir.exists (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>name</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the <i>directory</i> exists; otherwise returns false. (If a file with the same name is found this function will return false).</p>
<p>See also <a href="qfileinfo.html#exists">QFileInfo.exists</a>() and <a href="qfile.html#exists">QFile.exists</a>().</p>
<h3 class="fn"><a name="filePath" /><a href="qstring.html">QString</a> QDir.filePath (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>fileName</i>)</h3><p>Returns the path name of a file in the directory. Does <i>not</i> check if the file actually exists in the directory; but see <a href="qdir.html#exists">exists</a>(). If the <a href="qdir.html">QDir</a> is relative the returned path name will also be relative. Redundant multiple separators or "." and ".." directories in <i>fileName</i> are not removed (see <a href="qdir.html#cleanPath">cleanPath</a>()).</p>
<p>See also <a href="qdir.html#dirName">dirName</a>(), <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>
<h3 class="fn"><a name="filter" /><a href="qdir-filters.html">Filters</a> QDir.filter (<i>self</i>)</h3><p>Returns the value set by <a href="qdir.html#setFilter">setFilter</a>()</p>
<p>See also <a href="qdir.html#setFilter">setFilter</a>().</p>
<h3 class="fn"><a name="home" /><a href="qdir.html">QDir</a> QDir.home ()</h3><p>Returns the user's home directory. See <a href="qdir.html#homePath">homePath</a>() for details.</p>
<p>See also <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>
<h3 class="fn"><a name="homePath" /><a href="qstring.html">QString</a> QDir.homePath ()</h3><p>Returns the user's home directory.</p>
<p>Under Windows the <tt>HOME</tt> environment variable is used. If this does not exist the <tt>USERPROFILE</tt> environment variable is used. If that does not exist the path is formed by concatenating the <tt>HOMEDRIVE</tt> and <tt>HOMEPATH</tt> environment variables. If they don't exist the <a href="qdir.html#rootPath">rootPath</a>() is used (this uses the <tt>SystemDrive</tt> environment variable). If none of these exist "C:" is used.</p>
<p>Under non-Windows operating systems the <tt>HOME</tt> environment variable is used if it exists, otherwise <a href="qdir.html#rootPath">rootPath</a>() is used.</p>
<p>See also <a href="qdir.html#home">home</a>(), <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#rootPath">rootPath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>
<h3 class="fn"><a name="isAbsolute" />bool QDir.isAbsolute (<i>self</i>)</h3><p>Returns true if the directory's path is absolute; otherwise returns false. See <a href="qdir.html#isAbsolutePath">isAbsolutePath</a>().</p>
<p>See also <a href="qdir.html#isRelative">isRelative</a>(), <a href="qdir.html#makeAbsolute">makeAbsolute</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>
<h3 class="fn"><a name="isAbsolutePath" />bool QDir.isAbsolutePath (<a href="qstring.html">QString</a>&#160;<i>path</i>)</h3><p>Returns true if <i>path</i> is absolute; returns false if it is relative.</p>
<p>See also <a href="qdir.html#isAbsolute">isAbsolute</a>(), <a href="qdir.html#isRelativePath">isRelativePath</a>(), <a href="qdir.html#makeAbsolute">makeAbsolute</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>
<h3 class="fn"><a name="isReadable" />bool QDir.isReadable (<i>self</i>)</h3><p>Returns true if the directory is readable <i>and</i> we can open files by name; otherwise returns false.</p>
<p><b>Warning:</b> A false value from this function is not a guarantee that files in the directory are not accessible.</p>
<p>See also <a href="qfileinfo.html#isReadable">QFileInfo.isReadable</a>().</p>
<h3 class="fn"><a name="isRelative" />bool QDir.isRelative (<i>self</i>)</h3><p>Returns true if the directory path is relative; otherwise returns false. (Under Unix a path is relative if it does not start with a "/").</p>
<p>See also <a href="qdir.html#makeAbsolute">makeAbsolute</a>(), <a href="qdir.html#isAbsolute">isAbsolute</a>(), <a href="qdir.html#isAbsolutePath">isAbsolutePath</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>
<h3 class="fn"><a name="isRelativePath" />bool QDir.isRelativePath (<a href="qstring.html">QString</a>&#160;<i>path</i>)</h3><p>Returns true if <i>path</i> is relative; returns false if it is absolute.</p>
<p>See also <a href="qdir.html#isRelative">isRelative</a>(), <a href="qdir.html#isAbsolutePath">isAbsolutePath</a>(), and <a href="qdir.html#makeAbsolute">makeAbsolute</a>().</p>
<h3 class="fn"><a name="isRoot" />bool QDir.isRoot (<i>self</i>)</h3><p>Returns true if the directory is the root directory; otherwise returns false.</p>
<p>Note: If the directory is a symbolic link to the root directory this function returns false. If you want to test for this use <a href="qdir.html#canonicalPath">canonicalPath</a>(), e.g.</p>
<pre>
    QDir dir("/tmp/root_link");
    dir = dir.canonicalPath();
    if (dir.isRoot())
        qWarning("It is a root link");
</pre>
<p>See also <a href="qdir.html#root">root</a>() and <a href="qdir.html#rootPath">rootPath</a>().</p>
<h3 class="fn"><a name="makeAbsolute" />bool QDir.makeAbsolute (<i>self</i>)</h3><p>Converts the directory path to an absolute path. If it is already absolute nothing happens. Returns true if the conversion succeeded; otherwise returns false.</p>
<p>See also <a href="qdir.html#isAbsolute">isAbsolute</a>(), <a href="qdir.html#isAbsolutePath">isAbsolutePath</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#cleanPath">cleanPath</a>().</p>
<h3 class="fn"><a name="match" />bool QDir.match (<a href="qstringlist.html">QStringList</a>&#160;<i>filters</i>, <a href="qstring.html">QString</a>&#160;<i>fileName</i>)</h3><p>Returns true if the <i>fileName</i> matches the wildcard (glob) pattern <i>filter</i>; otherwise returns false. The <i>filter</i> may contain multiple patterns separated by spaces or semicolons. The matching is case insensitive.</p>
<p>See also <a href="qregexp.html#qregexp-wildcard-matching">QRegExp wildcard matching</a>, <a href="qregexp.html#exactMatch">QRegExp.exactMatch</a>(), <a href="qdir.html#entryList">entryList</a>(), and <a href="qdir.html#entryInfoList">entryInfoList</a>().</p>
<h3 class="fn"><a name="match-2" />bool QDir.match (<a href="qstring.html">QString</a>&#160;<i>filter</i>, <a href="qstring.html">QString</a>&#160;<i>fileName</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the <i>fileName</i> matches any of the wildcard (glob) patterns in the list of <i>filters</i>; otherwise returns false. The matching is case insensitive.</p>
<p>See also <a href="qregexp.html#qregexp-wildcard-matching">QRegExp wildcard matching</a>, <a href="qregexp.html#exactMatch">QRegExp.exactMatch</a>(), <a href="qdir.html#entryList">entryList</a>(), and <a href="qdir.html#entryInfoList">entryInfoList</a>().</p>
<h3 class="fn"><a name="mkdir" />bool QDir.mkdir (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>dirName</i>)</h3><p>Creates a sub-directory called <i>dirName</i>.</p>
<p>Returns true on success; otherwise returns false.</p>
<p>See also <a href="qdir.html#rmdir">rmdir</a>().</p>
<h3 class="fn"><a name="mkpath" />bool QDir.mkpath (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>dirPath</i>)</h3><p>Creates the directory path <i>dirPath</i>.</p>
<p>The function will create all parent directories necessary to create the directory.</p>
<p>Returns true if successful; otherwise returns false.</p>
<p>See also <a href="qdir.html#rmpath">rmpath</a>().</p>
<h3 class="fn"><a name="nameFilters" /><a href="qstringlist.html">QStringList</a> QDir.nameFilters (<i>self</i>)</h3><p>Returns the string list set by <a href="qdir.html#setNameFilters">setNameFilters</a>()</p>
<p>See also <a href="qdir.html#setNameFilters">setNameFilters</a>().</p>
<h3 class="fn"><a name="nameFiltersFromString" /><a href="qstringlist.html">QStringList</a> QDir.nameFiltersFromString (<a href="qstring.html">QString</a>&#160;<i>nameFilter</i>)</h3><h3 class="fn"><a name="path" /><a href="qstring.html">QString</a> QDir.path (<i>self</i>)</h3><p>Returns the path. This may contain symbolic links, but never contains redundant ".", ".." or multiple separators.</p>
<p>The returned path can be either absolute or relative (see <a href="qdir.html#setPath">setPath</a>()).</p>
<p>See also <a href="qdir.html#setPath">setPath</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qdir.html#convertSeparators">convertSeparators</a>(), and <a href="qdir.html#makeAbsolute">makeAbsolute</a>().</p>
<h3 class="fn"><a name="refresh" />QDir.refresh (<i>self</i>)</h3><p>Refreshes the directory information.</p>
<h3 class="fn"><a name="relativeFilePath" /><a href="qstring.html">QString</a> QDir.relativeFilePath (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>fileName</i>)</h3><p>Returns the path to <i>fileName</i> relative to the directory.</p>
<pre>
    QDir dir("/home/bob");
    QString s;

    s = dir.relativePath("images/file.jpg");     // s is "images/file.jpg"
    s = dir.relativePath("/home/mary/file.txt"); // s is "../mary/file.txt"
</pre>
<p>See also <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qdir.html#filePath">filePath</a>(), and <a href="qdir.html#canonicalPath">canonicalPath</a>().</p>
<h3 class="fn"><a name="remove" />bool QDir.remove (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>fileName</i>)</h3><p>Removes the file, <i>fileName</i>.</p>
<p>Returns true if the file is removed successfully; otherwise returns false.</p>
<h3 class="fn"><a name="rename" />bool QDir.rename (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>oldName</i>, <a href="qstring.html">QString</a>&#160;<i>newName</i>)</h3><p>Renames a file or directory from <i>oldName</i> to <i>newName</i>, and returns true if successful; otherwise returns false.</p>
<p>On most file systems, rename() fails only if <i>oldName</i> does not exist, if <i>newName</i> and <i>oldName</i> are not on the same partition or if a file with the new name already exists. However, there are also other reasons why rename() can fail. For example, on at least one file system rename() fails if <i>newName</i> points to an open file.</p>
<h3 class="fn"><a name="rmdir" />bool QDir.rmdir (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>dirName</i>)</h3><p>Removes the directory specified by <i>dirName</i>.</p>
<p>The directory must be empty for rmdir() to succeed.</p>
<p>Returns true if successful; otherwise returns false.</p>
<p>See also <a href="qdir.html#mkdir">mkdir</a>().</p>
<h3 class="fn"><a name="rmpath" />bool QDir.rmpath (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>dirPath</i>)</h3><p>Removes the directory path <i>dirPath</i>.</p>
<p>The function will remove all parent directories in <i>dirPath</i>, provided that they are empty. This is the opposite of mkpath(dirPath).</p>
<p>Returns true if successful; otherwise returns false.</p>
<p>See also <a href="qdir.html#mkpath">mkpath</a>().</p>
<h3 class="fn"><a name="root" /><a href="qdir.html">QDir</a> QDir.root ()</h3><p>Returns the root directory. See <a href="qdir.html#rootPath">rootPath</a>() for details.</p>
<p>See also <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#current">current</a>(), <a href="qdir.html#home">home</a>(), and <a href="qdir.html#temp">temp</a>().</p>
<h3 class="fn"><a name="rootPath" /><a href="qstring.html">QString</a> QDir.rootPath ()</h3><p>Returns the absolute path for the root directory.</p>
<p>For Unix operating systems this returns "/". For Windows file systems this normally returns "c:/".</p>
<p>See also <a href="qdir.html#root">root</a>(), <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#homePath">homePath</a>(), and <a href="qdir.html#tempPath">tempPath</a>().</p>
<h3 class="fn"><a name="separator" /><a href="qchar.html">QChar</a> QDir.separator ()</h3><p>Returns the native directory separator: "/" under Unix (including Mac OS X) and "\" under Windows.</p>
<p>You do not need to use this function to build file paths. If you always use "/", Qt will translate your paths to conform to the underlying operating system. If you want to display paths to the user using their operating system's separator use <a href="qdir.html#convertSeparators">convertSeparators</a>().</p>
<h3 class="fn"><a name="setCurrent" />bool QDir.setCurrent (<a href="qstring.html">QString</a>&#160;<i>path</i>)</h3><p>Sets the application's current working directory to <i>path</i>. Returns true if the directory was successfully changed; otherwise returns false.</p>
<p>See also <a href="qdir.html#current">current</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#home">home</a>(), <a href="qdir.html#root">root</a>(), and <a href="qdir.html#temp">temp</a>().</p>
<h3 class="fn"><a name="setFilter" />QDir.setFilter (<i>self</i>, <a href="qdir-filters.html">Filters</a>&#160;<i>filter</i>)</h3><p>Sets the filter used by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() to <i>filters</i>. The filter is used to specify the kind of files that should be returned by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>(). See <a href="qdir.html#Filter-enum">QDir.Filter</a>.</p>
<p>See also <a href="qdir.html#filter">filter</a>() and <a href="qdir.html#setNameFilters">setNameFilters</a>().</p>
<h3 class="fn"><a name="setNameFilters" />QDir.setNameFilters (<i>self</i>, <a href="qstringlist.html">QStringList</a>&#160;<i>nameFilters</i>)</h3><p>Sets the name filters used by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>() to the list of filters specified by <i>nameFilters</i>.</p>
<p>See also <a href="qdir.html#nameFilters">nameFilters</a>() and <a href="qdir.html#setFilter">setFilter</a>().</p>
<h3 class="fn"><a name="setPath" />QDir.setPath (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>path</i>)</h3><p>Sets the path of the directory to <i>path</i>. The path is cleaned of redundant ".", ".." and of multiple separators. No check is made to see whether a directory with this path actually exists; but you can check for yourself using <a href="qdir.html#exists">exists</a>().</p>
<p>The path can be either absolute or relative. Absolute paths begin with the directory separator "/" (optionally preceded by a drive specification under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory. An example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib".</p>
<p>See also <a href="qdir.html#path">path</a>(), <a href="qdir.html#absolutePath">absolutePath</a>(), <a href="qdir.html#exists">exists</a>(), <a href="qdir.html#cleanPath">cleanPath</a>(), <a href="qdir.html#dirName">dirName</a>(), <a href="qdir.html#absoluteFilePath">absoluteFilePath</a>(), <a href="qdir.html#isRelative">isRelative</a>(), and <a href="qdir.html#makeAbsolute">makeAbsolute</a>().</p>
<h3 class="fn"><a name="setSorting" />QDir.setSorting (<i>self</i>, <a href="qdir-sortflags.html">SortFlags</a>&#160;<i>sort</i>)</h3><p>Sets the sort order used by <a href="qdir.html#entryList">entryList</a>() and <a href="qdir.html#entryInfoList">entryInfoList</a>().</p>
<p>The <i>sort</i> is specified by OR-ing values from the enum <a href="qdir.html#SortFlag-enum">QDir.SortFlag</a>.</p>
<p>See also <a href="qdir.html#sorting">sorting</a>() and <a href="qdir.html#SortFlag-enum">SortFlag</a>.</p>
<h3 class="fn"><a name="sorting" /><a href="qdir-sortflags.html">SortFlags</a> QDir.sorting (<i>self</i>)</h3><p>Returns the value set by <a href="qdir.html#setSorting">setSorting</a>()</p>
<p>See also <a href="qdir.html#setSorting">setSorting</a>() and <a href="qdir.html#SortFlag-enum">SortFlag</a>.</p>
<h3 class="fn"><a name="temp" /><a href="qdir.html">QDir</a> QDir.temp ()</h3><p>Returns the system's temporary directory. See <a href="qdir.html#tempPath">tempPath</a>() for details.</p>
<p>See also <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#homePath">homePath</a>(), and <a href="qdir.html#rootPath">rootPath</a>().</p>
<h3 class="fn"><a name="tempPath" /><a href="qstring.html">QString</a> QDir.tempPath ()</h3><p>Returns the system's temporary directory.</p>
<p>On Unix/Linux systems this is usually <tt>/tmp</tt>; on Windows this is usually the path in the <tt>TEMP</tt> or <tt>TMP</tt> environment variable.</p>
<p>See also <a href="qdir.html#temp">temp</a>(), <a href="qdir.html#drives">drives</a>(), <a href="qdir.html#currentPath">currentPath</a>(), <a href="qdir.html#homePath">homePath</a>(), and <a href="qdir.html#rootPath">rootPath</a>().</p>
<h3 class="fn"><a name="__contains__" />int QDir.__contains__ (<i>self</i>, <a href="qstring.html">QString</a>)</h3><h3 class="fn"><a name="__eq__" />bool QDir.__eq__ (<i>self</i>, <a href="qdir.html">QDir</a>&#160;<i>dir</i>)</h3><h3 class="fn"><a name="__getitem__" /><a href="qstring.html">QString</a> QDir.__getitem__ (<i>self</i>, int)</h3><h3 class="fn"><a name="__getitem__-2" /><a href="qstringlist.html">QStringList</a> QDir.__getitem__ (<i>self</i>, slice)</h3><h3 class="fn"><a name="__len__" />int QDir.__len__ (<i>self</i>)</h3><h3 class="fn"><a name="__ne__" />bool QDir.__ne__ (<i>self</i>, <a href="qdir.html">QDir</a>&#160;<i>dir</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>