File: Filesystem-Utilities.html

package info (click to toggle)
octave 3.8.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 84,396 kB
  • ctags: 45,547
  • sloc: cpp: 293,356; ansic: 42,041; fortran: 23,669; sh: 13,629; objc: 7,890; yacc: 7,093; lex: 3,442; java: 2,125; makefile: 1,589; perl: 1,009; awk: 974; xml: 34
file content (762 lines) | stat: -rw-r--r-- 37,136 bytes parent folder | download | duplicates (3)
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Octave: Filesystem Utilities</title>

<meta name="description" content="GNU Octave: Filesystem Utilities">
<meta name="keywords" content="GNU Octave: Filesystem Utilities">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="System-Utilities.html#System-Utilities" rel="up" title="System Utilities">
<link href="File-Archiving-Utilities.html#File-Archiving-Utilities" rel="next" title="File Archiving Utilities">
<link href="Timing-Utilities.html#Timing-Utilities" rel="prev" title="Timing Utilities">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Filesystem-Utilities"></a>
<div class="header">
<p>
Next: <a href="File-Archiving-Utilities.html#File-Archiving-Utilities" accesskey="n" rel="next">File Archiving Utilities</a>, Previous: <a href="Timing-Utilities.html#Timing-Utilities" accesskey="p" rel="prev">Timing Utilities</a>, Up: <a href="System-Utilities.html#System-Utilities" accesskey="u" rel="up">System Utilities</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Filesystem-Utilities-1"></a>
<h3 class="section">36.2 Filesystem Utilities</h3>

<p>Octave includes many utility functions for copying, moving, renaming, and
deleting files; for creating, reading, and deleting directories; for retrieving
status information on files; and for manipulating file and path names.
</p>
<a name="XREFmovefile"></a><dl>
<dt><a name="index-movefile"></a>Function File: <em></em> <strong>movefile</strong> <em>(<var>f1</var>)</em></dt>
<dt><a name="index-movefile-1"></a>Function File: <em></em> <strong>movefile</strong> <em>(<var>f1</var>, <var>f2</var>)</em></dt>
<dt><a name="index-movefile-2"></a>Function File: <em></em> <strong>movefile</strong> <em>(<var>f1</var>, <var>f2</var>, 'f')</em></dt>
<dt><a name="index-movefile-3"></a>Function File: <em>[<var>status</var>, <var>msg</var>, <var>msgid</var>] =</em> <strong>movefile</strong> <em>(&hellip;)</em></dt>
<dd><p>Move the file <var>f1</var> to the destination <var>f2</var>.
</p>
<p>The name <var>f1</var> may contain globbing patterns.  If <var>f1</var> expands to
multiple file names, <var>f2</var> must be a directory.  If no destination
<var>f2</var> is specified then the destination is the present working directory.
If <var>f2</var> is a file name then <var>f1</var> is renamed to <var>f2</var>.
When the force flag <code>'f'</code> is given any existing files will be
overwritten without prompting.
</p>
<p>If successful, <var>status</var> is 1, and <var>msg</var>, <var>msgid</var> are empty
character strings (&quot;&quot;).  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique message
identifier.  Note that the status code is exactly opposite that of the
<code>system</code> command.
</p>
<p><strong>See also:</strong> <a href="#XREFrename">rename</a>, <a href="#XREFcopyfile">copyfile</a>, <a href="#XREFunlink">unlink</a>, <a href="Manipulation-of-Plot-Windows.html#XREFdelete">delete</a>, <a href="#XREFglob">glob</a>.
</p></dd></dl>


<a name="XREFrename"></a><dl>
<dt><a name="index-rename"></a>Built-in Function: <em></em> <strong>rename</strong> <em><var>old</var> <var>new</var></em></dt>
<dt><a name="index-rename-1"></a>Built-in Function: <em>[<var>err</var>, <var>msg</var>] =</em> <strong>rename</strong> <em>(<var>old</var>, <var>new</var>)</em></dt>
<dd><p>Change the name of file <var>old</var> to <var>new</var>.
</p>
<p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message.
</p>
<p><strong>See also:</strong> <a href="#XREFmovefile">movefile</a>, <a href="#XREFcopyfile">copyfile</a>, <a href="Current-Working-Directory.html#XREFls">ls</a>, <a href="Current-Working-Directory.html#XREFdir">dir</a>.
</p></dd></dl>


<a name="XREFcopyfile"></a><dl>
<dt><a name="index-copyfile"></a>Function File: <em>[<var>status</var>, <var>msg</var>, <var>msgid</var>] =</em> <strong>copyfile</strong> <em>(<var>f1</var>, <var>f2</var>)</em></dt>
<dt><a name="index-copyfile-1"></a>Function File: <em>[<var>status</var>, <var>msg</var>, <var>msgid</var>] =</em> <strong>copyfile</strong> <em>(<var>f1</var>, <var>f2</var>, 'f')</em></dt>
<dd><p>Copy the file <var>f1</var> to the destination <var>f2</var>.
</p>
<p>The name <var>f1</var> may contain globbing patterns.  If <var>f1</var> expands to
multiple file names, <var>f2</var> must be a directory.
when the force flag <code>'f'</code> is given any existing files will be
overwritten without prompting.
</p>
<p>If successful, <var>status</var> is 1, and <var>msg</var>, <var>msgid</var> are empty
character strings (&quot;&quot;).  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique message
identifier.  Note that the status code is exactly opposite that of the
<code>system</code> command.
</p>
<p><strong>See also:</strong> <a href="#XREFmovefile">movefile</a>, <a href="#XREFrename">rename</a>, <a href="#XREFunlink">unlink</a>, <a href="Manipulation-of-Plot-Windows.html#XREFdelete">delete</a>, <a href="#XREFglob">glob</a>.
</p></dd></dl>


<a name="XREFunlink"></a><dl>
<dt><a name="index-unlink"></a>Built-in Function: <em>[<var>err</var>, <var>msg</var>] =</em> <strong>unlink</strong> <em>(<var>file</var>)</em></dt>
<dd><p>Delete the file named <var>file</var>.
</p>
<p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message.
</p></dd></dl>


<a name="XREFlink"></a><dl>
<dt><a name="index-link"></a>Built-in Function: <em></em> <strong>link</strong> <em><var>old</var> <var>new</var></em></dt>
<dt><a name="index-link-1"></a>Built-in Function: <em>[<var>err</var>, <var>msg</var>] =</em> <strong>link</strong> <em>(<var>old</var>, <var>new</var>)</em></dt>
<dd><p>Create a new link (also known as a hard link) to an existing file.
</p>
<p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message.
</p>
<p><strong>See also:</strong> <a href="#XREFsymlink">symlink</a>, <a href="#XREFunlink">unlink</a>, <a href="#XREFreadlink">readlink</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFsymlink"></a><dl>
<dt><a name="index-symlink"></a>Built-in Function: <em></em> <strong>symlink</strong> <em><var>old</var> <var>new</var></em></dt>
<dt><a name="index-symlink-1"></a>Built-in Function: <em>[<var>err</var>, <var>msg</var>] =</em> <strong>symlink</strong> <em>(<var>old</var>, <var>new</var>)</em></dt>
<dd><p>Create a symbolic link <var>new</var> which contains the string <var>old</var>.
</p>
<p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message.
</p>
<p><strong>See also:</strong> <a href="#XREFlink">link</a>, <a href="#XREFunlink">unlink</a>, <a href="#XREFreadlink">readlink</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFreadlink"></a><dl>
<dt><a name="index-readlink"></a>Built-in Function: <em></em> <strong>readlink</strong> <em><var>symlink</var></em></dt>
<dt><a name="index-readlink-1"></a>Built-in Function: <em>[<var>result</var>, <var>err</var>, <var>msg</var>] =</em> <strong>readlink</strong> <em>(<var>symlink</var>)</em></dt>
<dd><p>Read the value of the symbolic link <var>symlink</var>.
</p>
<p>If successful, <var>result</var> contains the contents of the symbolic link
<var>symlink</var>, <var>err</var> is 0, and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a system-dependent
error message.
</p>
<p><strong>See also:</strong> <a href="#XREFlstat">lstat</a>, <a href="#XREFsymlink">symlink</a>, <a href="#XREFlink">link</a>, <a href="#XREFunlink">unlink</a>, <a href="Manipulation-of-Plot-Windows.html#XREFdelete">delete</a>.
</p></dd></dl>


<a name="XREFmkdir"></a><dl>
<dt><a name="index-mkdir"></a>Built-in Function: <em></em> <strong>mkdir</strong> <em><var>dir</var></em></dt>
<dt><a name="index-mkdir-1"></a>Built-in Function: <em></em> <strong>mkdir</strong> <em>(<var>parent</var>, <var>dir</var>)</em></dt>
<dt><a name="index-mkdir-2"></a>Built-in Function: <em>[<var>status</var>, <var>msg</var>, <var>msgid</var>] =</em> <strong>mkdir</strong> <em>(&hellip;)</em></dt>
<dd><p>Create a directory named <var>dir</var> in the directory <var>parent</var>.
</p>
<p>If no <var>parent</var> directory is specified the present working directory is
used.
</p>
<p>If successful, <var>status</var> is 1, and <var>msg</var>, <var>msgid</var> are empty
character strings (&quot;&quot;).  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique message
identifier.
</p>
<p><strong>See also:</strong> <a href="#XREFrmdir">rmdir</a>, <a href="Current-Working-Directory.html#XREFpwd">pwd</a>, <a href="Current-Working-Directory.html#XREFcd">cd</a>.
</p></dd></dl>


<a name="XREFrmdir"></a><dl>
<dt><a name="index-rmdir"></a>Built-in Function: <em></em> <strong>rmdir</strong> <em><var>dir</var></em></dt>
<dt><a name="index-rmdir-1"></a>Built-in Function: <em></em> <strong>rmdir</strong> <em>(<var>dir</var>, &quot;s&quot;)</em></dt>
<dt><a name="index-rmdir-2"></a>Built-in Function: <em>[<var>status</var>, <var>msg</var>, <var>msgid</var>] =</em> <strong>rmdir</strong> <em>(&hellip;)</em></dt>
<dd><p>Remove the directory named <var>dir</var>.
</p>
<p>If successful, <var>status</var> is 1, and <var>msg</var>, <var>msgid</var> are empty
character strings (&quot;&quot;).  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique message
identifier.
</p>
<p>If the optional second parameter is supplied with value <code>&quot;s&quot;</code>,
recursively remove all subdirectories as well.
</p>
<p><strong>See also:</strong> <a href="#XREFmkdir">mkdir</a>, <a href="#XREFconfirm_005frecursive_005frmdir">confirm_recursive_rmdir</a>, <a href="Current-Working-Directory.html#XREFpwd">pwd</a>.
</p></dd></dl>


<a name="XREFconfirm_005frecursive_005frmdir"></a><dl>
<dt><a name="index-confirm_005frecursive_005frmdir"></a>Built-in Function: <em><var>val</var> =</em> <strong>confirm_recursive_rmdir</strong> <em>()</em></dt>
<dt><a name="index-confirm_005frecursive_005frmdir-1"></a>Built-in Function: <em><var>old_val</var> =</em> <strong>confirm_recursive_rmdir</strong> <em>(<var>new_val</var>)</em></dt>
<dt><a name="index-confirm_005frecursive_005frmdir-2"></a>Built-in Function: <em></em> <strong>confirm_recursive_rmdir</strong> <em>(<var>new_val</var>, &quot;local&quot;)</em></dt>
<dd><p>Query or set the internal variable that controls whether Octave
will ask for confirmation before recursively removing a directory tree.
</p>
<p>When called from inside a function with the <code>&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.  
The original variable value is restored when exiting the function.
</p>
<p><strong>See also:</strong> <a href="#XREFrmdir">rmdir</a>.
</p></dd></dl>


<a name="XREFmkfifo"></a><dl>
<dt><a name="index-mkfifo"></a>Built-in Function: <em></em> <strong>mkfifo</strong> <em>(<var>name</var>, <var>mode</var>)</em></dt>
<dt><a name="index-mkfifo-1"></a>Built-in Function: <em>[<var>err</var>, <var>msg</var>] =</em> <strong>mkfifo</strong> <em>(<var>name</var>, <var>mode</var>)</em></dt>
<dd><p>Create a FIFO special file named <var>name</var> with file mode <var>mode</var>
</p>
<p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message.
</p>
<p><strong>See also:</strong> <a href="Controlling-Subprocesses.html#XREFpipe">pipe</a>.
</p></dd></dl>


<a name="XREFumask"></a><dl>
<dt><a name="index-umask"></a>Built-in Function: <em></em> <strong>umask</strong> <em>(<var>mask</var>)</em></dt>
<dd><p>Set the permission mask for file creation.  The parameter <var>mask</var>
is an integer, interpreted as an octal number.  If successful,
returns the previous value of the mask (as an integer to be
interpreted as an octal number); otherwise an error message is printed.
</p></dd></dl>


<a name="XREFlstat"></a><a name="XREFstat"></a><dl>
<dt><a name="index-stat"></a>Built-in Function: <em>[<var>info</var>, <var>err</var>, <var>msg</var>] =</em> <strong>stat</strong> <em>(<var>file</var>)</em></dt>
<dt><a name="index-stat-1"></a>Built-in Function: <em>[<var>info</var>, <var>err</var>, <var>msg</var>] =</em> <strong>stat</strong> <em>(<var>fid</var>)</em></dt>
<dt><a name="index-lstat"></a>Built-in Function: <em>[<var>info</var>, <var>err</var>, <var>msg</var>] =</em> <strong>lstat</strong> <em>(<var>file</var>)</em></dt>
<dt><a name="index-lstat-1"></a>Built-in Function: <em>[<var>info</var>, <var>err</var>, <var>msg</var>] =</em> <strong>lstat</strong> <em>(<var>fid</var>)</em></dt>
<dd><p>Return a structure <var>info</var> containing the following information about
<var>file</var> or file identifier <var>fid</var>.
</p>
<dl compact="compact">
<dt><code>dev</code></dt>
<dd><p>ID of device containing a directory entry for this file.
</p>
</dd>
<dt><code>ino</code></dt>
<dd><p>File number of the file.
</p>
</dd>
<dt><code>mode</code></dt>
<dd><p>File mode, as an integer.  Use the functions <code><span class="nolinebreak">S_ISREG</span></code><!-- /@w -->,
<code><span class="nolinebreak">S_ISDIR</span></code><!-- /@w -->, <code><span class="nolinebreak">S_ISCHR</span></code><!-- /@w -->, <code><span class="nolinebreak">S_ISBLK</span></code><!-- /@w -->,
<code><span class="nolinebreak">S_ISFIFO</span></code><!-- /@w -->, <code><span class="nolinebreak">S_ISLNK</span></code><!-- /@w -->, or <code><span class="nolinebreak">S_ISSOCK</span></code><!-- /@w --> to extract
information from this value.
</p>
</dd>
<dt><code>modestr</code></dt>
<dd><p>File mode, as a string of ten letters or dashes as would be returned by
<kbd>ls -l</kbd>.
</p>
</dd>
<dt><code>nlink</code></dt>
<dd><p>Number of links.
</p>
</dd>
<dt><code>uid</code></dt>
<dd><p>User ID of file&rsquo;s owner.
</p>
</dd>
<dt><code>gid</code></dt>
<dd><p>Group ID of file&rsquo;s group.
</p>
</dd>
<dt><code>rdev</code></dt>
<dd><p>ID of device for block or character special files.
</p>
</dd>
<dt><code>size</code></dt>
<dd><p>Size in bytes.
</p>
</dd>
<dt><code>atime</code></dt>
<dd><p>Time of last access in the same form as time values returned from
<code>time</code>.  See <a href="Timing-Utilities.html#Timing-Utilities">Timing Utilities</a>.
</p>
</dd>
<dt><code>mtime</code></dt>
<dd><p>Time of last modification in the same form as time values returned from
<code>time</code>.  See <a href="Timing-Utilities.html#Timing-Utilities">Timing Utilities</a>.
</p>
</dd>
<dt><code>ctime</code></dt>
<dd><p>Time of last file status change in the same form as time values
returned from <code>time</code>.  See <a href="Timing-Utilities.html#Timing-Utilities">Timing Utilities</a>.
</p>
</dd>
<dt><code>blksize</code></dt>
<dd><p>Size of blocks in the file.
</p>
</dd>
<dt><code>blocks</code></dt>
<dd><p>Number of blocks allocated for file.
</p></dd>
</dl>

<p>If the call is successful <var>err</var> is 0 and <var>msg</var> is an empty
string.  If the file does not exist, or some other error occurs, <var>info</var>
is an empty matrix, <var>err</var> is -1, and <var>msg</var> contains the
corresponding system error message.
</p>
<p>If <var>file</var> is a symbolic link, <code>stat</code> will return information
about the actual file that is referenced by the link.  Use <code>lstat</code>
if you want information about the symbolic link itself.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">[info, err, msg] = stat (&quot;/vmlinuz&quot;)
  &rArr; info =
     {
       atime = 855399756
       rdev = 0
       ctime = 847219094
       uid = 0
       size = 389218
       blksize = 4096
       mtime = 847219094
       gid = 6
       nlink = 1
       blocks = 768
       mode = -rw-r--r--
       modestr = -rw-r--r--
       ino = 9316
       dev = 2049
     }
  &rArr; err = 0
  &rArr; msg =
</pre></div>

<p><strong>See also:</strong> <a href="#XREFlstat">lstat</a>, <a href="Current-Working-Directory.html#XREFls">ls</a>, <a href="Current-Working-Directory.html#XREFdir">dir</a>.
</p></dd></dl>


<a name="XREFS_005fISBLK"></a><dl>
<dt><a name="index-S_005fISBLK"></a>Built-in Function: <em></em> <strong>S_ISBLK</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a block device.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFS_005fISCHR"></a><dl>
<dt><a name="index-S_005fISCHR"></a>Built-in Function: <em></em> <strong>S_ISCHR</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a character device.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFS_005fISDIR"></a><dl>
<dt><a name="index-S_005fISDIR"></a>Built-in Function: <em></em> <strong>S_ISDIR</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a directory.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFS_005fISFIFO"></a><dl>
<dt><a name="index-S_005fISFIFO"></a>Built-in Function: <em></em> <strong>S_ISFIFO</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a fifo.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFS_005fISLNK"></a><dl>
<dt><a name="index-S_005fISLNK"></a>Built-in Function: <em></em> <strong>S_ISLNK</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a symbolic link.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFS_005fISREG"></a><dl>
<dt><a name="index-S_005fISREG"></a>Built-in Function: <em></em> <strong>S_ISREG</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a regular file.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFS_005fISSOCK"></a><dl>
<dt><a name="index-S_005fISSOCK"></a>Built-in Function: <em></em> <strong>S_ISSOCK</strong> <em>(<var>mode</var>)</em></dt>
<dd><p>Return true if <var>mode</var> corresponds to a socket.
</p>
<p>The value of <var>mode</var> is assumed to be returned from a call to <code>stat</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFstat">stat</a>, <a href="#XREFlstat">lstat</a>.
</p></dd></dl>


<a name="XREFfileattrib"></a><dl>
<dt><a name="index-fileattrib"></a>Function File: <em>[<var>status</var>, <var>result</var>, <var>msgid</var>] =</em> <strong>fileattrib</strong> <em>(<var>file</var>)</em></dt>
<dd><p>Return information about <var>file</var>.
</p>
<p>If successful, <var>status</var> is 1, with <var>result</var> containing a
structure with the following fields:
</p>
<dl compact="compact">
<dt><code>Name</code></dt>
<dd><p>Full name of <var>file</var>.
</p>
</dd>
<dt><code>archive</code></dt>
<dd><p>True if <var>file</var> is an archive (Windows).
</p>
</dd>
<dt><code>system</code></dt>
<dd><p>True if <var>file</var> is a system file (Windows).
</p>
</dd>
<dt><code>hidden</code></dt>
<dd><p>True if <var>file</var> is a hidden file (Windows).
</p>
</dd>
<dt><code>directory</code></dt>
<dd><p>True if <var>file</var> is a directory.
</p>
</dd>
<dt><code>UserRead</code></dt>
<dt><code>GroupRead</code></dt>
<dt><code>OtherRead</code></dt>
<dd><p>True if the user (group; other users) has read permission for
<var>file</var>.
</p>
</dd>
<dt><code>UserWrite</code></dt>
<dt><code>GroupWrite</code></dt>
<dt><code>OtherWrite</code></dt>
<dd><p>True if the user (group; other users) has write permission for
<var>file</var>.
</p>
</dd>
<dt><code>UserExecute</code></dt>
<dt><code>GroupExecute</code></dt>
<dt><code>OtherExecute</code></dt>
<dd><p>True if the user (group; other users) has execute permission for
<var>file</var>.
</p></dd>
</dl>

<p>If an attribute does not apply (i.e., archive on a Unix system) then
the field is set to NaN.
</p>
<p>With no input arguments, return information about the current
directory.
</p>
<p>If <var>file</var> contains globbing characters, return information about
all the matching files.
</p>
<p><strong>See also:</strong> <a href="#XREFglob">glob</a>.
</p></dd></dl>


<a name="XREFisdir"></a><dl>
<dt><a name="index-isdir"></a>Function File: <em></em> <strong>isdir</strong> <em>(<var>f</var>)</em></dt>
<dd><p>Return true if <var>f</var> is a directory.
</p>
<p><strong>See also:</strong> <a href="Status-of-Variables.html#XREFexist">exist</a>, <a href="#XREFstat">stat</a>, <a href="#XREFis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="#XREFis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>.
</p></dd></dl>


<a name="XREFreaddir"></a><dl>
<dt><a name="index-readdir"></a>Built-in Function: <em><var>files</var> =</em> <strong>readdir</strong> <em>(<var>dir</var>)</em></dt>
<dt><a name="index-readdir-1"></a>Built-in Function: <em>[<var>files</var>, <var>err</var>, <var>msg</var>] =</em> <strong>readdir</strong> <em>(<var>dir</var>)</em></dt>
<dd><p>Return the names of files in the directory <var>dir</var> as a cell array of
strings.
</p>
<p>If an error occurs, return an empty cell array in <var>files</var>.
If successful, <var>err</var> is 0 and <var>msg</var> is an empty string.
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message.
</p>
<p><strong>See also:</strong> <a href="Current-Working-Directory.html#XREFls">ls</a>, <a href="Current-Working-Directory.html#XREFdir">dir</a>, <a href="#XREFglob">glob</a>, <a href="Status-of-Variables.html#XREFwhat">what</a>.
</p></dd></dl>


<a name="XREFglob"></a><dl>
<dt><a name="index-glob"></a>Built-in Function: <em></em> <strong>glob</strong> <em>(<var>pattern</var>)</em></dt>
<dd><p>Given an array of pattern strings (as a char array or a cell array) in
<var>pattern</var>, return a cell array of file names that match any of
them, or an empty cell array if no patterns match.  The pattern strings are
interpreted as filename globbing patterns (as they are used by Unix shells).
Within a pattern
</p>
<dl compact="compact">
<dt><code>*</code></dt>
<dd><p>matches any string, including the null string,
</p>
</dd>
<dt><code>?</code></dt>
<dd><p>matches any single character, and
</p>
</dd>
<dt><code>[&hellip;]</code></dt>
<dd><p>matches any of the enclosed characters.
</p></dd>
</dl>

<p>Tilde expansion is performed on each of the patterns before looking for
matching file names.  For example:
</p>
<div class="example">
<pre class="example">ls
   &rArr;
      file1  file2  file3  myfile1 myfile1b
glob (&quot;*file1&quot;)
   &rArr;
      {
        [1,1] = file1
        [2,1] = myfile1
      }
glob (&quot;myfile?&quot;)
   &rArr;
      {
        [1,1] = myfile1
      }
glob (&quot;file[12]&quot;)
   &rArr;
      {
        [1,1] = file1
        [2,1] = file2
      }
</pre></div>

<p><strong>See also:</strong> <a href="Current-Working-Directory.html#XREFls">ls</a>, <a href="Current-Working-Directory.html#XREFdir">dir</a>, <a href="#XREFreaddir">readdir</a>, <a href="Status-of-Variables.html#XREFwhat">what</a>, <a href="#XREFfnmatch">fnmatch</a>.
</p></dd></dl>


<a name="XREFfnmatch"></a><dl>
<dt><a name="index-fnmatch"></a>Built-in Function: <em></em> <strong>fnmatch</strong> <em>(<var>pattern</var>, <var>string</var>)</em></dt>
<dd><p>Return true or false for each element of <var>string</var> that matches any of
the elements of the string array <var>pattern</var>, using the rules of
filename pattern matching.  For example:
</p>
<div class="example">
<pre class="example">fnmatch (&quot;a*b&quot;, {&quot;ab&quot;; &quot;axyzb&quot;; &quot;xyzab&quot;})
     &rArr; [ 1; 1; 0 ]
</pre></div>

<p><strong>See also:</strong> <a href="#XREFglob">glob</a>, <a href="Manipulating-Strings.html#XREFregexp">regexp</a>.
</p></dd></dl>


<a name="XREFfile_005fin_005fpath"></a><dl>
<dt><a name="index-file_005fin_005fpath"></a>Built-in Function: <em></em> <strong>file_in_path</strong> <em>(<var>path</var>, <var>file</var>)</em></dt>
<dt><a name="index-file_005fin_005fpath-1"></a>Built-in Function: <em></em> <strong>file_in_path</strong> <em>(<var>path</var>, <var>file</var>, &quot;all&quot;)</em></dt>
<dd><p>Return the absolute name of <var>file</var> if it can be found in
<var>path</var>.  The value of <var>path</var> should be a colon-separated list of
directories in the format described for <code>path</code>.  If no file
is found, return an empty character string.  For example:
</p>
<div class="example">
<pre class="example">file_in_path (EXEC_PATH, &quot;sh&quot;)
     &rArr; &quot;/bin/sh&quot;
</pre></div>

<p>If the second argument is a cell array of strings, search each
directory of the path for element of the cell array and return
the first that matches.
</p>
<p>If the third optional argument <code>&quot;all&quot;</code> is supplied, return
a cell array containing the list of all files that have the same
name in the path.  If no files are found, return an empty cell array.
</p>
<p><strong>See also:</strong> <a href="Manipulating-the-Load-Path.html#XREFfile_005fin_005floadpath">file_in_loadpath</a>, <a href="Manipulating-the-Load-Path.html#XREFfind_005fdir_005fin_005fpath">find_dir_in_path</a>, <a href="Manipulating-the-Load-Path.html#XREFpath">path</a>.
</p></dd></dl>


<a name="XREFfilesep"></a><dl>
<dt><a name="index-filesep"></a>Built-in Function: <em></em> <strong>filesep</strong> <em>()</em></dt>
<dt><a name="index-filesep-1"></a>Built-in Function: <em></em> <strong>filesep</strong> <em>(&quot;all&quot;)</em></dt>
<dd><p>Return the system-dependent character used to separate directory names.
</p>
<p>If <code>&quot;all&quot;</code> is given, the function returns all valid file separators
in the form of a string.  The list of file separators is system-dependent.
It is &lsquo;<samp>/</samp>&rsquo; (forward slash) under UNIX or Mac&nbsp;OS&nbsp;X<!-- /@w -->, &lsquo;<samp>/</samp>&rsquo; and
&lsquo;<samp>\</samp>&rsquo; (forward and backward slashes) under Windows.
</p>
<p><strong>See also:</strong> <a href="Manipulating-the-Load-Path.html#XREFpathsep">pathsep</a>.
</p></dd></dl>


<a name="XREFfilemarker"></a><dl>
<dt><a name="index-filemarker"></a>Built-in Function: <em><var>val</var> =</em> <strong>filemarker</strong> <em>()</em></dt>
<dt><a name="index-filemarker-1"></a>Built-in Function: <em></em> <strong>filemarker</strong> <em>(<var>new_val</var>)</em></dt>
<dt><a name="index-filemarker-2"></a>Built-in Function: <em></em> <strong>filemarker</strong> <em>(<var>new_val</var>, &quot;local&quot;)</em></dt>
<dd><p>Query or set the character used to separate filename from the
the subfunction names contained within the file.  This can be used in
a generic manner to interact with subfunctions.  For example,
</p>
<div class="example">
<pre class="example">help ([&quot;myfunc&quot;, filemarker, &quot;mysubfunc&quot;])
</pre></div>

<p>returns the help string associated with the subfunction <code>mysubfunc</code>
of the function <code>myfunc</code>.  Another use of <code>filemarker</code> is when
debugging it allows easier placement of breakpoints within subfunctions.
For example,
</p>
<div class="example">
<pre class="example">dbstop ([&quot;myfunc&quot;, filemarker, &quot;mysubfunc&quot;])
</pre></div>

<p>will set a breakpoint at the first line of the subfunction <code>mysubfunc</code>.
</p>
<p>When called from inside a function with the <code>&quot;local&quot;</code> option, the
variable is changed locally for the function and any subroutines it calls.  
The original variable value is restored when exiting the function.
</p></dd></dl>


<a name="XREFfileparts"></a><dl>
<dt><a name="index-fileparts"></a>Function File: <em>[<var>dir</var>, <var>name</var>, <var>ext</var>, <var>ver</var>] =</em> <strong>fileparts</strong> <em>(<var>filename</var>)</em></dt>
<dd><p>Return the directory, name, extension, and version components of
<var>filename</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFfullfile">fullfile</a>.
</p></dd></dl>


<a name="XREFfullfile"></a><dl>
<dt><a name="index-fullfile"></a>Function File: <em><var>filename</var> =</em> <strong>fullfile</strong> <em>(<var>dir1</var>, <var>dir2</var>, &hellip;, <var>file</var>)</em></dt>
<dd><p>Return a complete filename constructed from the given components.
</p>
<p><strong>See also:</strong> <a href="#XREFfileparts">fileparts</a>.
</p></dd></dl>


<a name="XREFtilde_005fexpand"></a><dl>
<dt><a name="index-tilde_005fexpand"></a>Built-in Function: <em></em> <strong>tilde_expand</strong> <em>(<var>string</var>)</em></dt>
<dd><p>Perform tilde expansion on <var>string</var>.  If <var>string</var> begins with a
tilde character, (&lsquo;<samp>~</samp>&rsquo;), all of the characters preceding the first
slash (or all characters, if there is no slash) are treated as a
possible user name, and the tilde and the following characters up to the
slash are replaced by the home directory of the named user.  If the
tilde is followed immediately by a slash, the tilde is replaced by the
home directory of the user running Octave.  For example:
</p>
<div class="example">
<pre class="example">tilde_expand (&quot;~joeuser/bin&quot;)
     &rArr; &quot;/home/joeuser/bin&quot;
tilde_expand (&quot;~/bin&quot;)
     &rArr; &quot;/home/jwe/bin&quot;
</pre></div>
</dd></dl>


<a name="XREFcanonicalize_005ffile_005fname"></a><dl>
<dt><a name="index-canonicalize_005ffile_005fname"></a>Built-in Function: <em>[<var>cname</var>, <var>status</var>, <var>msg</var>] =</em> <strong>canonicalize_file_name</strong> <em>(<var>fname</var>)</em></dt>
<dd><p>Return the canonical name of file <var>fname</var>.  If the file does not exist
the empty string (&quot;&quot;) is returned.
</p>
<p><strong>See also:</strong> <a href="#XREFmake_005fabsolute_005ffilename">make_absolute_filename</a>, <a href="#XREFis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="#XREFis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>.
</p></dd></dl>


<a name="XREFmake_005fabsolute_005ffilename"></a><dl>
<dt><a name="index-make_005fabsolute_005ffilename"></a>Built-in Function: <em></em> <strong>make_absolute_filename</strong> <em>(<var>file</var>)</em></dt>
<dd><p>Return the full name of <var>file</var> beginning from the root of the file
system.  No check is done for the existence of <var>file</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFcanonicalize_005ffile_005fname">canonicalize_file_name</a>, <a href="#XREFis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="#XREFis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>, <a href="#XREFisdir">isdir</a>.
</p></dd></dl>


<a name="XREFis_005fabsolute_005ffilename"></a><dl>
<dt><a name="index-is_005fabsolute_005ffilename"></a>Built-in Function: <em></em> <strong>is_absolute_filename</strong> <em>(<var>file</var>)</em></dt>
<dd><p>Return true if <var>file</var> is an absolute filename.
</p>
<p><strong>See also:</strong> <a href="#XREFis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>, <a href="#XREFmake_005fabsolute_005ffilename">make_absolute_filename</a>, <a href="#XREFisdir">isdir</a>.
</p></dd></dl>


<a name="XREFis_005frooted_005frelative_005ffilename"></a><dl>
<dt><a name="index-is_005frooted_005frelative_005ffilename"></a>Built-in Function: <em></em> <strong>is_rooted_relative_filename</strong> <em>(<var>file</var>)</em></dt>
<dd><p>Return true if <var>file</var> is a rooted-relative filename.
</p>
<p><strong>See also:</strong> <a href="#XREFis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="#XREFmake_005fabsolute_005ffilename">make_absolute_filename</a>, <a href="#XREFisdir">isdir</a>.
</p></dd></dl>


<a name="XREFP_005ftmpdir"></a><dl>
<dt><a name="index-P_005ftmpdir"></a>Built-in Function: <em></em> <strong>P_tmpdir</strong> <em>()</em></dt>
<dd><p>Return the default name of the directory for temporary files on
this system.  The name of this directory is system dependent.
</p></dd></dl>


<a name="XREFtempdir"></a><dl>
<dt><a name="index-tempdir"></a>Function File: <em><var>dir</var> =</em> <strong>tempdir</strong> <em>()</em></dt>
<dd><p>Return the name of the system&rsquo;s directory for temporary files.
</p></dd></dl>


<a name="XREFtempname"></a><dl>
<dt><a name="index-tempname"></a>Function File: <em></em> <strong>tempname</strong> <em>()</em></dt>
<dt><a name="index-tempname-1"></a>Function File: <em></em> <strong>tempname</strong> <em>(<var>dir</var>)</em></dt>
<dt><a name="index-tempname-2"></a>Function File: <em></em> <strong>tempname</strong> <em>(<var>dir</var>, <var>prefix</var>)</em></dt>
<dd><p>This function is an alias for <code>tmpnam</code>.
</p>
<p><strong>See also:</strong> <a href="Temporary-Files.html#XREFtmpnam">tmpnam</a>.
</p></dd></dl>


<a name="XREFrecycle"></a><dl>
<dt><a name="index-recycle"></a>Function File: <em><var>current_state</var> =</em> <strong>recycle</strong> <em>()</em></dt>
<dt><a name="index-recycle-1"></a>Function File: <em><var>old_state</var> =</em> <strong>recycle</strong> <em>(<var>new_state</var>)</em></dt>
<dd><p>Query or set the preference for recycling deleted files.
</p>
<p>Recycling files, instead of permanently deleting them, is not currently
implemented in Octave.  To help avoid accidental data loss an error
will be raised if an attempt is made to enable file recycling.
</p>
<p><strong>See also:</strong> <a href="Manipulation-of-Plot-Windows.html#XREFdelete">delete</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="File-Archiving-Utilities.html#File-Archiving-Utilities" accesskey="n" rel="next">File Archiving Utilities</a>, Previous: <a href="Timing-Utilities.html#Timing-Utilities" accesskey="p" rel="prev">Timing Utilities</a>, Up: <a href="System-Utilities.html#System-Utilities" accesskey="u" rel="up">System Utilities</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>