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
|
<!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: Current Working Directory</title>
<meta name="description" content="GNU Octave: Current Working Directory">
<meta name="keywords" content="GNU Octave: Current Working Directory">
<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="Password-Database-Functions.html#Password-Database-Functions" rel="next" title="Password Database Functions">
<link href="Environment-Variables.html#Environment-Variables" rel="prev" title="Environment Variables">
<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="Current-Working-Directory"></a>
<div class="header">
<p>
Next: <a href="Password-Database-Functions.html#Password-Database-Functions" accesskey="n" rel="next">Password Database Functions</a>, Previous: <a href="Environment-Variables.html#Environment-Variables" accesskey="p" rel="prev">Environment Variables</a>, Up: <a href="System-Utilities.html#System-Utilities" accesskey="u" rel="up">System Utilities</a> [<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="Current-Working-Directory-1"></a>
<h3 class="section">36.8 Current Working Directory</h3>
<a name="XREFcd"></a><dl>
<dt><a name="index-cd-3"></a>Command: <em></em> <strong>cd</strong> <em><var>dir</var></em></dt>
<dt><a name="index-cd-4"></a>Command: <em></em> <strong>cd</strong></dt>
<dt><a name="index-cd-5"></a>Built-in Function: <em><var>old_dir</var> =</em> <strong>cd</strong> <em><var>dir</var></em></dt>
<dt><a name="index-chdir-1"></a>Command: <em></em> <strong>chdir</strong> <em>…</em></dt>
<dd><p>Change the current working directory to <var>dir</var>.
</p>
<p>If <var>dir</var> is omitted, the current directory is changed to the user’s home
directory (<code>"~"</code>).
</p>
<p>For example,
</p>
<div class="example">
<pre class="example">cd ~/octave
</pre></div>
<p>changes the current working directory to <samp>~/octave</samp>. If the
directory does not exist, an error message is printed and the working
directory is not changed.
</p>
<p><code>chdir</code> is an alias for <code>cd</code> and can be used in all of the same
calling formats.
</p>
<p>Compatibility Note: When called with no arguments, <small>MATLAB</small> prints the
present working directory rather than changing to the user’s home directory.
</p>
<p><strong>See also:</strong> <a href="#XREFpwd">pwd</a>, <a href="Filesystem-Utilities.html#XREFmkdir">mkdir</a>, <a href="Filesystem-Utilities.html#XREFrmdir">rmdir</a>, <a href="#XREFdir">dir</a>, <a href="#XREFls">ls</a>.
</p></dd></dl>
<a name="XREFls"></a><dl>
<dt><a name="index-ls"></a>Command: <em></em> <strong>ls</strong></dt>
<dt><a name="index-ls-1"></a>Command: <em></em> <strong>ls</strong> <em>filenames</em></dt>
<dt><a name="index-ls-2"></a>Command: <em></em> <strong>ls</strong> <em>options</em></dt>
<dt><a name="index-ls-3"></a>Command: <em></em> <strong>ls</strong> <em>options filenames</em></dt>
<dd><p>List directory contents. For example:
</p>
<div class="example">
<pre class="example">ls -l
-| total 12
-| -rw-r--r-- 1 jwe users 4488 Aug 19 04:02 foo.m
-| -rw-r--r-- 1 jwe users 1315 Aug 17 23:14 bar.m
</pre></div>
<p>The <code>dir</code> and <code>ls</code> commands are implemented by calling your
system’s directory listing command, so the available options will vary
from system to system.
</p>
<p>Filenames are subject to shell expansion if they contain any wildcard
characters ‘<samp>*</samp>’, ‘<samp>?</samp>’, ‘<samp>[]</samp>’. If you want to find a
literal example of a wildcard character you must escape it using the
backslash operator ‘<samp>\</samp>’.
</p>
<p><strong>See also:</strong> <a href="#XREFdir">dir</a>, <a href="Filesystem-Utilities.html#XREFreaddir">readdir</a>, <a href="Filesystem-Utilities.html#XREFglob">glob</a>, <a href="Status-of-Variables.html#XREFwhat">what</a>, <a href="Filesystem-Utilities.html#XREFstat">stat</a>, <a href="Filesystem-Utilities.html#XREFfilesep">filesep</a>, <a href="#XREFls_005fcommand">ls_command</a>.
</p></dd></dl>
<a name="XREFls_005fcommand"></a><dl>
<dt><a name="index-ls_005fcommand"></a>Function File: <em><var>val</var> =</em> <strong>ls_command</strong> <em>()</em></dt>
<dt><a name="index-ls_005fcommand-1"></a>Function File: <em><var>old_val</var> =</em> <strong>ls_command</strong> <em>(<var>new_val</var>)</em></dt>
<dd><p>Query or set the shell command used by Octave’s <code>ls</code> command.
</p>
<p><strong>See also:</strong> <a href="#XREFls">ls</a>.
</p></dd></dl>
<a name="XREFdir"></a><dl>
<dt><a name="index-dir-1"></a>Function File: <em></em> <strong>dir</strong></dt>
<dt><a name="index-dir-2"></a>Function File: <em></em> <strong>dir</strong> <em>(<var>directory</var>)</em></dt>
<dt><a name="index-dir-3"></a>Function File: <em>[<var>list</var>] =</em> <strong>dir</strong> <em>(<var>directory</var>)</em></dt>
<dd><p>Display file listing for directory <var>directory</var>.
</p>
<p>If <var>directory</var> is not specified then list the present working directory.
</p>
<p>If a return value is requested, return a structure array with the fields
</p>
<dl compact="compact">
<dt>name</dt>
<dd><p>File or directory name.
</p>
</dd>
<dt>date</dt>
<dd><p>Timestamp of file modification (string value).
</p>
</dd>
<dt>bytes</dt>
<dd><p>File size in bytes.
</p>
</dd>
<dt>isdir</dt>
<dd><p>True if name is a directory.
</p>
</dd>
<dt>datenum</dt>
<dd><p>Timestamp of file modification as serial date number (double).
</p>
</dd>
<dt>statinfo</dt>
<dd><p>Information structure returned from <code>stat</code>.
</p></dd>
</dl>
<p>If <var>directory</var> is a filename, rather than a directory, then return
information about the named file. <var>directory</var> may also be a list rather
than a single directory or file.
</p>
<p><var>directory</var> is subject to shell expansion if it contains any wildcard
characters ‘<samp>*</samp>’, ‘<samp>?</samp>’, ‘<samp>[]</samp>’. If you want to find a
literal example of a wildcard character you must escape it using the
backslash operator ‘<samp>\</samp>’.
</p>
<p>Note that for symbolic links, <code>dir</code> returns information about
the file that the symbolic link points to rather than the link itself.
However, if the link points to a nonexistent file, <code>dir</code> returns
information about the link.
</p>
<p><strong>See also:</strong> <a href="#XREFls">ls</a>, <a href="Filesystem-Utilities.html#XREFreaddir">readdir</a>, <a href="Filesystem-Utilities.html#XREFglob">glob</a>, <a href="Status-of-Variables.html#XREFwhat">what</a>, <a href="Filesystem-Utilities.html#XREFstat">stat</a>.
</p></dd></dl>
<a name="XREFpwd"></a><dl>
<dt><a name="index-pwd"></a>Built-in Function: <em></em> <strong>pwd</strong> <em>()</em></dt>
<dt><a name="index-pwd-1"></a>Built-in Function: <em><var>dir</var> =</em> <strong>pwd</strong> <em>()</em></dt>
<dd><p>Return the current working directory.
</p>
<p><strong>See also:</strong> <a href="#XREFcd">cd</a>, <a href="#XREFdir">dir</a>, <a href="#XREFls">ls</a>, <a href="Filesystem-Utilities.html#XREFmkdir">mkdir</a>, <a href="Filesystem-Utilities.html#XREFrmdir">rmdir</a>.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Password-Database-Functions.html#Password-Database-Functions" accesskey="n" rel="next">Password Database Functions</a>, Previous: <a href="Environment-Variables.html#Environment-Variables" accesskey="p" rel="prev">Environment Variables</a>, Up: <a href="System-Utilities.html#System-Utilities" accesskey="u" rel="up">System Utilities</a> [<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>
|