File: Filesystem-Utilities.html

package info (click to toggle)
octave 3.6.2-5%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 71,636 kB
  • sloc: cpp: 241,186; fortran: 23,651; sh: 14,790; ansic: 7,153; lex: 3,761; objc: 3,404; yacc: 3,386; makefile: 2,073; awk: 985; perl: 838
file content (782 lines) | stat: -rw-r--r-- 39,961 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
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
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
<html lang="en">
<head>
<title>Filesystem Utilities - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="System-Utilities.html#System-Utilities" title="System Utilities">
<link rel="prev" href="Timing-Utilities.html#Timing-Utilities" title="Timing Utilities">
<link rel="next" href="File-Archiving-Utilities.html#File-Archiving-Utilities" title="File Archiving Utilities">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Filesystem-Utilities"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="File-Archiving-Utilities.html#File-Archiving-Utilities">File Archiving Utilities</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Timing-Utilities.html#Timing-Utilities">Timing Utilities</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="System-Utilities.html#System-Utilities">System Utilities</a>
<hr>
</div>

<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.

<!-- movefile scripts/miscellaneous/movefile.m -->
   <p><a name="doc_002dmovefile"></a>

<div class="defun">
&mdash; Function File: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>movefile</b> (<var>f1, f2</var>)<var><a name="index-movefile-3151"></a></var><br>
&mdash; Function File: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>movefile</b> (<var>f1, f2, 'f'</var>)<var><a name="index-movefile-3152"></a></var><br>
<blockquote><p>Move the file <var>f1</var> to the new name <var>f2</var>.  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 the force flag 'f' is given
then any existing files will be overwritten without prompting.

        <p>If successful, <var>status</var> is 1, with <var>msg</var> and <var>msgid</var> empty
character strings.  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique
message identifier. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002drename.html#doc_002drename">rename</a>, <a href="doc_002dcopyfile.html#doc_002dcopyfile">copyfile</a>. 
</p></blockquote></div>

<!-- rename src/dirfns.cc -->
   <p><a name="doc_002drename"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>rename</b> (<var>old, new</var>)<var><a name="index-rename-3153"></a></var><br>
<blockquote><p>Change the name of file <var>old</var> to <var>new</var>.

        <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. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dls.html#doc_002dls">ls</a>, <a href="doc_002ddir.html#doc_002ddir">dir</a>. 
</p></blockquote></div>

<!-- copyfile scripts/miscellaneous/copyfile.m -->
   <p><a name="doc_002dcopyfile"></a>

<div class="defun">
&mdash; Function File: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>copyfile</b> (<var>f1, f2</var>)<var><a name="index-copyfile-3154"></a></var><br>
&mdash; Function File: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>copyfile</b> (<var>f1, f2, 'f'</var>)<var><a name="index-copyfile-3155"></a></var><br>
<blockquote><p>Copy the file <var>f1</var> to the new name <var>f2</var>.  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 the force flag 'f' is given then
existing destination files will be overwritten without prompting.

        <p>If successful, <var>status</var> is 1, with <var>msg</var> and <var>msgid</var> empty
character strings.  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique
message identifier. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dmovefile.html#doc_002dmovefile">movefile</a>. 
</p></blockquote></div>

<!-- unlink src/syscalls.cc -->
   <p><a name="doc_002dunlink"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>unlink</b> (<var>file</var>)<var><a name="index-unlink-3156"></a></var><br>
<blockquote><p>Delete the file named <var>file</var>.

        <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></blockquote></div>

<!-- link src/dirfns.cc -->
   <p><a name="doc_002dlink"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>link</b> (<var>old, new</var>)<var><a name="index-link-3157"></a></var><br>
<blockquote><p>Create a new link (also known as a hard link) to an existing file.

        <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. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsymlink.html#doc_002dsymlink">symlink</a>. 
</p></blockquote></div>

<!-- symlink src/dirfns.cc -->
   <p><a name="doc_002dsymlink"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>symlink</b> (<var>old, new</var>)<var><a name="index-symlink-3158"></a></var><br>
<blockquote><p>Create a symbolic link <var>new</var> which contains the string <var>old</var>.

        <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. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dlink.html#doc_002dlink">link</a>, <a href="doc_002dreadlink.html#doc_002dreadlink">readlink</a>. 
</p></blockquote></div>

<!-- readlink src/dirfns.cc -->
   <p><a name="doc_002dreadlink"></a>

<div class="defun">
&mdash; Built-in Function: [<var>result</var>, <var>err</var>, <var>msg</var>] = <b>readlink</b> (<var>symlink</var>)<var><a name="index-readlink-3159"></a></var><br>
<blockquote><p>Read the value of the symbolic link <var>symlink</var>.

        <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. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dlink.html#doc_002dlink">link</a>, <a href="doc_002dsymlink.html#doc_002dsymlink">symlink</a>. 
</p></blockquote></div>

<!-- mkdir src/dirfns.cc -->
   <p><a name="doc_002dmkdir"></a>

<div class="defun">
&mdash; Built-in Function: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>mkdir</b> (<var>dir</var>)<var><a name="index-mkdir-3160"></a></var><br>
&mdash; Built-in Function: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>mkdir</b> (<var>parent, dir</var>)<var><a name="index-mkdir-3161"></a></var><br>
<blockquote><p>Create a directory named <var>dir</var> in the directory <var>parent</var>.

        <p>If successful, <var>status</var> is 1, with <var>msg</var> and <var>msgid</var> empty
character strings.  Otherwise, <var>status</var> is 0, <var>msg</var> contains a
system-dependent error message, and <var>msgid</var> contains a unique
message identifier. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002drmdir.html#doc_002drmdir">rmdir</a>. 
</p></blockquote></div>

<!-- rmdir src/dirfns.cc -->
   <p><a name="doc_002drmdir"></a>

<div class="defun">
&mdash; Built-in Function: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>rmdir</b> (<var>dir</var>)<var><a name="index-rmdir-3162"></a></var><br>
&mdash; Built-in Function: [<var>status</var>, <var>msg</var>, <var>msgid</var>] = <b>rmdir</b> (<var>dir, "s"</var>)<var><a name="index-rmdir-3163"></a></var><br>
<blockquote><p>Remove the directory named <var>dir</var>.

        <p>If successful, <var>status</var> is 1, with <var>msg</var> and <var>msgid</var> empty
character strings.  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>If the optional second parameter is supplied with value <code>"s"</code>,
recursively remove all subdirectories as well. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dmkdir.html#doc_002dmkdir">mkdir</a>, <a href="doc_002dconfirm_005frecursive_005frmdir.html#doc_002dconfirm_005frecursive_005frmdir">confirm_recursive_rmdir</a>. 
</p></blockquote></div>

<!-- confirm_recursive_rmdir src/dirfns.cc -->
   <p><a name="doc_002dconfirm_005frecursive_005frmdir"></a>

<div class="defun">
&mdash; Built-in Function: <var>val</var> = <b>confirm_recursive_rmdir</b> ()<var><a name="index-confirm_005frecursive_005frmdir-3164"></a></var><br>
&mdash; Built-in Function: <var>old_val</var> = <b>confirm_recursive_rmdir</b> (<var>new_val</var>)<var><a name="index-confirm_005frecursive_005frmdir-3165"></a></var><br>
&mdash; Built-in Function:  <b>confirm_recursive_rmdir</b> (<var>new_val, "local"</var>)<var><a name="index-confirm_005frecursive_005frmdir-3166"></a></var><br>
<blockquote><p>Query or set the internal variable that controls whether Octave
will ask for confirmation before recursively removing a directory tree.

        <p>When called from inside a function with the "local" 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></blockquote></div>

<!-- mkfifo src/syscalls.cc -->
   <p><a name="doc_002dmkfifo"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>mkfifo</b> (<var>name, mode</var>)<var><a name="index-mkfifo-3167"></a></var><br>
<blockquote><p>Create a <var>fifo</var> special file named <var>name</var> with file mode <var>mode</var>

        <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></blockquote></div>

<!-- umask src/file-io.cc -->
   <p><a name="doc_002dumask"></a>

<div class="defun">
&mdash; Built-in Function:  <b>umask</b> (<var>mask</var>)<var><a name="index-umask-3168"></a></var><br>
<blockquote><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></blockquote></div>

   <p><a name="doc_002dlstat"></a><!-- stat src/syscalls.cc -->
<a name="doc_002dstat"></a>

<div class="defun">
&mdash; Built-in Function: [<var>info</var>, <var>err</var>, <var>msg</var>] = <b>stat</b> (<var>file</var>)<var><a name="index-stat-3169"></a></var><br>
&mdash; Built-in Function: [<var>info</var>, <var>err</var>, <var>msg</var>] = <b>stat</b> (<var>fid</var>)<var><a name="index-stat-3170"></a></var><br>
&mdash; Built-in Function: [<var>info</var>, <var>err</var>, <var>msg</var>] = <b>lstat</b> (<var>file</var>)<var><a name="index-lstat-3171"></a></var><br>
&mdash; Built-in Function: [<var>info</var>, <var>err</var>, <var>msg</var>] = <b>lstat</b> (<var>fid</var>)<var><a name="index-lstat-3172"></a></var><br>
<blockquote><p>Return a structure <var>info</var> containing the following information about
<var>file</var> or file identifier <var>fid</var>.

          <dl>
<dt><code>dev</code><dd>ID of device containing a directory entry for this file.

          <br><dt><code>ino</code><dd>File number of the file.

          <br><dt><code>mode</code><dd>File mode, as an integer.  Use the functions <code>S_ISREG</code><!-- /@w -->,
<code>S_ISDIR</code><!-- /@w -->, <code>S_ISCHR</code><!-- /@w -->, <code>S_ISBLK</code><!-- /@w -->, <code>S_ISFIFO</code><!-- /@w -->,
<code>S_ISLNK</code><!-- /@w -->, or <code>S_ISSOCK</code><!-- /@w --> to extract information from this
value.

          <br><dt><code>modestr</code><dd>File mode, as a string of ten letters or dashes as would be returned by
<kbd>ls -l</kbd>.

          <br><dt><code>nlink</code><dd>Number of links.

          <br><dt><code>uid</code><dd>User ID of file's owner.

          <br><dt><code>gid</code><dd>Group ID of file's group.

          <br><dt><code>rdev</code><dd>ID of device for block or character special files.

          <br><dt><code>size</code><dd>Size in bytes.

          <br><dt><code>atime</code><dd>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>.

          <br><dt><code>mtime</code><dd>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>.

          <br><dt><code>ctime</code><dd>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>.

          <br><dt><code>blksize</code><dd>Size of blocks in the file.

          <br><dt><code>blocks</code><dd>Number of blocks allocated for file. 
</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>s</var>
is an empty matrix, <var>err</var> is &minus;1, and <var>msg</var> contains the
corresponding system error message.

        <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>For example:

     <pre class="example">          [s, err, msg] = stat ("/vmlinuz")
                &rArr; s =
                  {
                    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>
        </blockquote></div>

<!-- S_ISBLK src/syscalls.cc -->
   <p><a name="doc_002dS_005fISBLK"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISBLK</b> (<var>mode</var>)<var><a name="index-S_005fISBLK-3173"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a block device.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- S_ISCHR src/syscalls.cc -->
   <p><a name="doc_002dS_005fISCHR"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISCHR</b> (<var>mode</var>)<var><a name="index-S_005fISCHR-3174"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a character device.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- S_ISDIR src/syscalls.cc -->
   <p><a name="doc_002dS_005fISDIR"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISDIR</b> (<var>mode</var>)<var><a name="index-S_005fISDIR-3175"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a directory.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- S_ISFIFO src/syscalls.cc -->
   <p><a name="doc_002dS_005fISFIFO"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISFIFO</b> (<var>mode</var>)<var><a name="index-S_005fISFIFO-3176"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a fifo.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- S_ISLNK src/syscalls.cc -->
   <p><a name="doc_002dS_005fISLNK"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISLNK</b> (<var>mode</var>)<var><a name="index-S_005fISLNK-3177"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a symbolic link.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- S_ISREG src/syscalls.cc -->
   <p><a name="doc_002dS_005fISREG"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISREG</b> (<var>mode</var>)<var><a name="index-S_005fISREG-3178"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a regular file.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- S_ISSOCK src/syscalls.cc -->
   <p><a name="doc_002dS_005fISSOCK"></a>

<div class="defun">
&mdash; Built-in Function:  <b>S_ISSOCK</b> (<var>mode</var>)<var><a name="index-S_005fISSOCK-3179"></a></var><br>
<blockquote><p>Return true if <var>mode</var> corresponds to a socket.  The value
of <var>mode</var> is assumed to be returned from a call to <code>stat</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dstat.html#doc_002dstat">stat</a>, <a href="doc_002dlstat.html#doc_002dlstat">lstat</a>. 
</p></blockquote></div>

<!-- fileattrib scripts/miscellaneous/fileattrib.m -->
   <p><a name="doc_002dfileattrib"></a>

<div class="defun">
&mdash; Function File: [<var>status</var>, <var>result</var>, <var>msgid</var>] = <b>fileattrib</b> (<var>file</var>)<var><a name="index-fileattrib-3180"></a></var><br>
<blockquote><p>Return information about <var>file</var>.

        <p>If successful, <var>status</var> is 1, with <var>result</var> containing a
structure with the following fields:

          <dl>
<dt><code>Name</code><dd>Full name of <var>file</var>.

          <br><dt><code>archive</code><dd>True if <var>file</var> is an archive (Windows).

          <br><dt><code>system</code><dd>True if <var>file</var> is a system file (Windows).

          <br><dt><code>hidden</code><dd>True if <var>file</var> is a hidden file (Windows).

          <br><dt><code>directory</code><dd>True if <var>file</var> is a directory.

          <br><dt><code>UserRead</code><dt><code>GroupRead</code><dt><code>OtherRead</code><dd>True if the user (group; other users) has read permission for
<var>file</var>.

          <br><dt><code>UserWrite</code><dt><code>GroupWrite</code><dt><code>OtherWrite</code><dd>True if the user (group; other users) has write permission for
<var>file</var>.

          <br><dt><code>UserExecute</code><dt><code>GroupExecute</code><dt><code>OtherExecute</code><dd>True if the user (group; other users) has execute permission for
<var>file</var>. 
</dl>
        If an attribute does not apply (i.e., archive on a Unix system) then
the field is set to NaN.

        <p>With no input arguments, return information about the current
directory.

        <p>If <var>file</var> contains globbing characters, return information about
all the matching files. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dglob.html#doc_002dglob">glob</a>. 
</p></blockquote></div>

<!-- isdir scripts/general/isdir.m -->
   <p><a name="doc_002disdir"></a>

<div class="defun">
&mdash; Function File:  <b>isdir</b> (<var>f</var>)<var><a name="index-isdir-3181"></a></var><br>
<blockquote><p>Return true if <var>f</var> is a directory. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dis_005fabsolute_005ffilename.html#doc_002dis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="doc_002dis_005frooted_005frelative_005ffilename.html#doc_002dis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>. 
</p></blockquote></div>

<!-- readdir src/dirfns.cc -->
   <p><a name="doc_002dreaddir"></a>

<div class="defun">
&mdash; Built-in Function: [<var>files</var>, <var>err</var>, <var>msg</var>] = <b>readdir</b> (<var>dir</var>)<var><a name="index-readdir-3182"></a></var><br>
<blockquote><p>Return names of the files in the directory <var>dir</var> as a cell array of
strings.  If an error occurs, return an empty cell array in <var>files</var>.

        <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. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dls.html#doc_002dls">ls</a>, <a href="doc_002ddir.html#doc_002ddir">dir</a>, <a href="doc_002dglob.html#doc_002dglob">glob</a>. 
</p></blockquote></div>

<!-- glob src/dirfns.cc -->
   <p><a name="doc_002dglob"></a>

<div class="defun">
&mdash; Built-in Function:  <b>glob</b> (<var>pattern</var>)<var><a name="index-glob-3183"></a></var><br>
<blockquote><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
          <dl>
<dt><code>*</code><dd>matches any string, including the null string,
<dt><code>?</code><dd>matches any single character, and

          <br><dt><code>[...]</code><dd>matches any of the enclosed characters. 
</dl>

        <p>Tilde expansion
is performed on each of the patterns before looking for matching file
names.  For example:

     <pre class="example">          ls
               &rArr;
                  file1  file2  file3  myfile1 myfile1b
          glob ("*file1")
               &rArr;
                  {
                    [1,1] = file1
                    [2,1] = myfile1
                  }
          glob ("myfile?")
               &rArr;
                  {
                    [1,1] = myfile1
                  }
          glob ("file[12]")
               &rArr;
                  {
                    [1,1] = file1
                    [2,1] = file2
                  }
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dls.html#doc_002dls">ls</a>, <a href="doc_002ddir.html#doc_002ddir">dir</a>, <a href="doc_002dreaddir.html#doc_002dreaddir">readdir</a>. 
</p></blockquote></div>

<!-- fnmatch src/dirfns.cc -->
   <p><a name="doc_002dfnmatch"></a>

<div class="defun">
&mdash; Built-in Function:  <b>fnmatch</b> (<var>pattern, string</var>)<var><a name="index-fnmatch-3184"></a></var><br>
<blockquote><p>Return 1 or zero 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:

     <pre class="example">          fnmatch ("a*b", {"ab"; "axyzb"; "xyzab"})
               &rArr; [ 1; 1; 0 ]
</pre>
        </blockquote></div>

<!-- file_in_path src/utils.cc -->
   <p><a name="doc_002dfile_005fin_005fpath"></a>

<div class="defun">
&mdash; Built-in Function:  <b>file_in_path</b> (<var>path, file</var>)<var><a name="index-file_005fin_005fpath-3185"></a></var><br>
&mdash; Built-in Function:  <b>file_in_path</b> (<var>path, file, "all"</var>)<var><a name="index-file_005fin_005fpath-3186"></a></var><br>
<blockquote><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:

     <pre class="example">          file_in_path (EXEC_PATH, "sh")
               &rArr; "/bin/sh"
</pre>
        <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>If the third optional argument <code>"all"</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. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfile_005fin_005floadpath.html#doc_002dfile_005fin_005floadpath">file_in_loadpath</a>. 
</p></blockquote></div>

<!-- filesep src/dirfns.cc -->
   <p><a name="doc_002dfilesep"></a>

<div class="defun">
&mdash; Built-in Function:  <b>filesep</b> ()<var><a name="index-filesep-3187"></a></var><br>
&mdash; Built-in Function:  <b>filesep</b> (<var>'all'</var>)<var><a name="index-filesep-3188"></a></var><br>
<blockquote><p>Return the system-dependent character used to separate directory names.

        <p>If 'all' 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><span class="samp">/</span></samp>&rsquo; (forward slash) under UNIX or Mac&nbsp;OS&nbsp;X<!-- /@w -->, &lsquo;<samp><span class="samp">/</span></samp>&rsquo; and
&lsquo;<samp><span class="samp">\</span></samp>&rsquo; (forward and backward slashes) under Windows. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dpathsep.html#doc_002dpathsep">pathsep</a>. 
</p></blockquote></div>

<!-- filemarker src/input.cc -->
   <p><a name="doc_002dfilemarker"></a>

<div class="defun">
&mdash; Built-in Function: <var>val</var> = <b>filemarker</b> ()<var><a name="index-filemarker-3189"></a></var><br>
&mdash; Built-in Function:  <b>filemarker</b> (<var>new_val</var>)<var><a name="index-filemarker-3190"></a></var><br>
&mdash; Built-in Function:  <b>filemarker</b> (<var>new_val, "local"</var>)<var><a name="index-filemarker-3191"></a></var><br>
<blockquote><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,

     <pre class="example">          help (["myfunc", filemarker, "mysubfunc"])
</pre>
        <p class="noindent">returns the help string associated with the sub-function <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 sub-functions. 
For example,

     <pre class="example">          dbstop (["myfunc", filemarker, "mysubfunc"])
</pre>
        <p class="noindent">will set a breakpoint at the first line of the subfunction <code>mysubfunc</code>.

        <p>When called from inside a function with the "local" 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></blockquote></div>

<!-- fileparts scripts/miscellaneous/fileparts.m -->
   <p><a name="doc_002dfileparts"></a>

<div class="defun">
&mdash; Function File: [<var>dir</var>, <var>name</var>, <var>ext</var>, <var>ver</var>] = <b>fileparts</b> (<var>filename</var>)<var><a name="index-fileparts-3192"></a></var><br>
<blockquote><p>Return the directory, name, extension, and version components of
<var>filename</var>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfullfile.html#doc_002dfullfile">fullfile</a>. 
</p></blockquote></div>

<!-- fullfile scripts/miscellaneous/fullfile.m -->
   <p><a name="doc_002dfullfile"></a>

<div class="defun">
&mdash; Function File: <var>filename</var> = <b>fullfile</b> (<var>dir1, dir2, <small class="dots">...</small>, file</var>)<var><a name="index-fullfile-3193"></a></var><br>
<blockquote><p>Return a complete filename constructed from the given components. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfileparts.html#doc_002dfileparts">fileparts</a>. 
</p></blockquote></div>

<!-- tilde_expand src/sysdep.cc -->
   <p><a name="doc_002dtilde_005fexpand"></a>

<div class="defun">
&mdash; Built-in Function:  <b>tilde_expand</b> (<var>string</var>)<var><a name="index-tilde_005fexpand-3194"></a></var><br>
<blockquote><p>Perform tilde expansion on <var>string</var>.  If <var>string</var> begins with a
tilde character, (&lsquo;<samp><span class="samp">~</span></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:

     <pre class="example">          tilde_expand ("~joeuser/bin")
               &rArr; "/home/joeuser/bin"
          tilde_expand ("~/bin")
               &rArr; "/home/jwe/bin"
</pre>
        </blockquote></div>

<!-- canonicalize_file_name src/syscalls.cc -->
   <p><a name="doc_002dcanonicalize_005ffile_005fname"></a>

<div class="defun">
&mdash; Built-in Function: [<var>cname</var>, <var>status</var>, <var>msg</var>] <b>canonicalize_file_name</b> (<var>name</var>)<var><a name="index-canonicalize_005ffile_005fname-3195"></a></var><br>
<blockquote><p>Return the canonical name of file <var>name</var>. 
</p></blockquote></div>

<!-- make_absolute_filename src/utils.cc -->
   <p><a name="doc_002dmake_005fabsolute_005ffilename"></a>

<div class="defun">
&mdash; Built-in Function:  <b>make_absolute_filename</b> (<var>file</var>)<var><a name="index-make_005fabsolute_005ffilename-3196"></a></var><br>
<blockquote><p>Return the full name of <var>file</var>, relative to the current directory. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dis_005fabsolute_005ffilename.html#doc_002dis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="doc_002dis_005frooted_005frelative_005ffilename.html#doc_002dis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>, <a href="doc_002disdir.html#doc_002disdir">isdir</a>. 
</p></blockquote></div>

<!-- is_absolute_filename src/utils.cc -->
   <p><a name="doc_002dis_005fabsolute_005ffilename"></a>

<div class="defun">
&mdash; Built-in Function:  <b>is_absolute_filename</b> (<var>file</var>)<var><a name="index-is_005fabsolute_005ffilename-3197"></a></var><br>
<blockquote><p>Return true if <var>file</var> is an absolute filename. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dis_005frooted_005frelative_005ffilename.html#doc_002dis_005frooted_005frelative_005ffilename">is_rooted_relative_filename</a>, <a href="doc_002dmake_005fabsolute_005ffilename.html#doc_002dmake_005fabsolute_005ffilename">make_absolute_filename</a>, <a href="doc_002disdir.html#doc_002disdir">isdir</a>. 
</p></blockquote></div>

<!-- is_rooted_relative_filename src/utils.cc -->
   <p><a name="doc_002dis_005frooted_005frelative_005ffilename"></a>

<div class="defun">
&mdash; Built-in Function:  <b>is_rooted_relative_filename</b> (<var>file</var>)<var><a name="index-is_005frooted_005frelative_005ffilename-3198"></a></var><br>
<blockquote><p>Return true if <var>file</var> is a rooted-relative filename. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dis_005fabsolute_005ffilename.html#doc_002dis_005fabsolute_005ffilename">is_absolute_filename</a>, <a href="doc_002dmake_005fabsolute_005ffilename.html#doc_002dmake_005fabsolute_005ffilename">make_absolute_filename</a>, <a href="doc_002disdir.html#doc_002disdir">isdir</a>. 
</p></blockquote></div>

<!-- P_tmpdir src/file-io.cc -->
   <p><a name="doc_002dP_005ftmpdir"></a>

<div class="defun">
&mdash; Built-in Function:  <b>P_tmpdir</b> ()<var><a name="index-P_005ftmpdir-3199"></a></var><br>
<blockquote><p>Return the default name of the directory for temporary files on
this system.  The name of this directory is system dependent. 
</p></blockquote></div>

<!-- tempdir scripts/miscellaneous/tempdir.m -->
   <p><a name="doc_002dtempdir"></a>

<div class="defun">
&mdash; Function File: <var>dir</var> = <b>tempdir</b> ()<var><a name="index-tempdir-3200"></a></var><br>
<blockquote><p>Return the name of the system's directory for temporary files. 
</p></blockquote></div>

<!-- tempname scripts/miscellaneous/tempname.m -->
   <p><a name="doc_002dtempname"></a>

<div class="defun">
&mdash; Function File:  <b>tempname</b> ()<var><a name="index-tempname-3201"></a></var><br>
&mdash; Function File:  <b>tempname</b> (<var>dir</var>)<var><a name="index-tempname-3202"></a></var><br>
&mdash; Function File:  <b>tempname</b> (<var>dir, prefix</var>)<var><a name="index-tempname-3203"></a></var><br>
<blockquote><p>This function is an alias for <code>tmpnam</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dtmpnam.html#doc_002dtmpnam">tmpnam</a>. 
</p></blockquote></div>

<!-- recycle scripts/miscellaneous/recycle.m -->
   <p><a name="doc_002drecycle"></a>

<div class="defun">
&mdash; Function File: <var>current_state</var> <b>recycle</b> ()<var><a name="index-recycle-3204"></a></var><br>
&mdash; Function File: <var>old_state</var> <b>recycle</b> (<var>new_state</var>)<var><a name="index-recycle-3205"></a></var><br>
<blockquote><p>Query or set the preference for recycling deleted files.

        <p>Recycling files instead of permanently deleting them is currently not
implemented in Octave.  To help avoid accidental data loss it
is an error to attempt enable file recycling. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002ddelete.html#doc_002ddelete">delete</a>. 
</p></blockquote></div>

   </body></html>