<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: <a rel="next" accesskey="n" href="File-Archiving-Utilities.html#File-Archiving-Utilities">File Archiving Utilities</a>, Previous: <a rel="previous" accesskey="p" href="Timing-Utilities.html#Timing-Utilities">Timing Utilities</a>, Up: <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"> — 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> — 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"> — 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"> — 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> — 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"> — 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"> — 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"> — 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"> — 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"> — 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> — 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"> — 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> — 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"> — Built-in Function: <var>val</var> = <b>confirm_recursive_rmdir</b> ()<var><a name="index-confirm_005frecursive_005frmdir-3164"></a></var><br> — 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> — 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"> — 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"> — 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"> — 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> — 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> — 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> — 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 −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") ⇒ 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 } ⇒ err = 0 ⇒ msg = </pre> </blockquote></div> <!-- S_ISBLK src/syscalls.cc --> <p><a name="doc_002dS_005fISBLK"></a> <div class="defun"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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 ⇒ file1 file2 file3 myfile1 myfile1b glob ("*file1") ⇒ { [1,1] = file1 [2,1] = myfile1 } glob ("myfile?") ⇒ { [1,1] = myfile1 } glob ("file[12]") ⇒ { [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"> — 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"}) ⇒ [ 1; 1; 0 ] </pre> </blockquote></div> <!-- file_in_path src/utils.cc --> <p><a name="doc_002dfile_005fin_005fpath"></a> <div class="defun"> — Built-in Function: <b>file_in_path</b> (<var>path, file</var>)<var><a name="index-file_005fin_005fpath-3185"></a></var><br> — 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") ⇒ "/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"> — Built-in Function: <b>filesep</b> ()<var><a name="index-filesep-3187"></a></var><br> — 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 ‘<samp><span class="samp">/</span></samp>’ (forward slash) under UNIX or Mac OS X<!-- /@w -->, ‘<samp><span class="samp">/</span></samp>’ and ‘<samp><span class="samp">\</span></samp>’ (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"> — Built-in Function: <var>val</var> = <b>filemarker</b> ()<var><a name="index-filemarker-3189"></a></var><br> — Built-in Function: <b>filemarker</b> (<var>new_val</var>)<var><a name="index-filemarker-3190"></a></var><br> — 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"> — 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"> — 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"> — 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, (‘<samp><span class="samp">~</span></samp>’), 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") ⇒ "/home/joeuser/bin" tilde_expand ("~/bin") ⇒ "/home/jwe/bin" </pre> </blockquote></div> <!-- canonicalize_file_name src/syscalls.cc --> <p><a name="doc_002dcanonicalize_005ffile_005fname"></a> <div class="defun"> — 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"> — 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"> — 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"> — 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"> — 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"> — 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"> — Function File: <b>tempname</b> ()<var><a name="index-tempname-3201"></a></var><br> — Function File: <b>tempname</b> (<var>dir</var>)<var><a name="index-tempname-3202"></a></var><br> — 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"> — Function File: <var>current_state</var> <b>recycle</b> ()<var><a name="index-recycle-3204"></a></var><br> — 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>