File: Current-Working-Directory.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (201 lines) | stat: -rw-r--r-- 9,267 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Current Working Directory (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Current Working Directory (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Current Working Directory (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="System-Utilities.html" rel="up" title="System Utilities">
<link href="Password-Database-Functions.html" rel="next" title="Password Database Functions">
<link href="Environment-Variables.html" rel="prev" title="Environment Variables">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {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}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="Current-Working-Directory"></span><div class="header">
<p>
Next: <a href="Password-Database-Functions.html" accesskey="n" rel="next">Password Database Functions</a>, Previous: <a href="Environment-Variables.html" accesskey="p" rel="prev">Environment Variables</a>, Up: <a href="System-Utilities.html" 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" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Current-Working-Directory-1"></span><h3 class="section">36.8 Current Working Directory</h3>

<span id="XREFcd"></span><dl>
<dt id="index-cd-2">: <em></em> <strong>cd</strong> <em><var>dir</var></em></dt>
<dt id="index-cd-3">: <em></em> <strong>cd</strong></dt>
<dt id="index-cd-4">: <em><var>old_dir</var> =</em> <strong>cd</strong></dt>
<dt id="index-cd-5">: <em><var>old_dir</var> =</em> <strong>cd</strong> <em>(<var>dir</var>)</em></dt>
<dt id="index-chdir">: <em></em> <strong>chdir</strong> <em>&hellip;</em></dt>
<dd><p>Change the current working directory to <var>dir</var>.
</p>
<p>If called with no input or output arguments, the current directory is
changed to the user&rsquo;s home directory (<code>&quot;~&quot;</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&rsquo;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>


<span id="XREFls"></span><dl>
<dt id="index-ls">: <em></em> <strong>ls</strong></dt>
<dt id="index-ls-1">: <em></em> <strong>ls</strong> <em><var>filenames</var></em></dt>
<dt id="index-ls-2">: <em></em> <strong>ls</strong> <em><var>options</var></em></dt>
<dt id="index-ls-3">: <em></em> <strong>ls</strong> <em><var>options</var> <var>filenames</var></em></dt>
<dt id="index-ls-4">: <em><var>list</var> =</em> <strong>ls</strong> <em>(&hellip;)</em></dt>
<dd>
<p>List directory contents.
</p>
<p>The <code>ls</code> command is implemented by calling the native operating
system&rsquo;s directory listing command&mdash;available <var>options</var> will vary from
system to system.
</p>
<p>Filenames are subject to shell expansion if they contain any wildcard
characters &lsquo;<samp>*</samp>&rsquo;, &lsquo;<samp>?</samp>&rsquo;, &lsquo;<samp>[]</samp>&rsquo;.  To find a literal example of a
wildcard character the wildcard must be escaped using the backslash operator
&lsquo;<samp>\</samp>&rsquo;.
</p>
<p>If the optional output <var>list</var> is requested then <code>ls</code> returns a
character array with one row for each file/directory name.
</p>
<p>Example usage on a UNIX-like system:
</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><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>


<span id="XREFls_005fcommand"></span><dl>
<dt id="index-ls_005fcommand">: <em><var>val</var> =</em> <strong>ls_command</strong> <em>()</em></dt>
<dt id="index-ls_005fcommand-1">: <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&rsquo;s <code>ls</code> command.
</p>
<p><strong>See also:</strong> <a href="#XREFls">ls</a>.
</p></dd></dl>


<span id="XREFdir"></span><dl>
<dt id="index-dir-1">: <em></em> <strong>dir</strong></dt>
<dt id="index-dir-2">: <em></em> <strong>dir</strong> <em>(<var>directory</var>)</em></dt>
<dt id="index-dir-3">: <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>folder</dt>
<dd><p>Location of file or directory
</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 &lsquo;<samp>*</samp>&rsquo;, &lsquo;<samp>?</samp>&rsquo;, &lsquo;<samp>[]</samp>&rsquo;.  To find a literal example of a
wildcard character the wildcard must be escaped using the backslash operator
&lsquo;<samp>\</samp>&rsquo;.
</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>, <a href="Filesystem-Utilities.html#XREFlstat">lstat</a>.
</p></dd></dl>


<span id="XREFpwd"></span><dl>
<dt id="index-pwd">: <em></em> <strong>pwd</strong> <em>()</em></dt>
<dt id="index-pwd-1">: <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" accesskey="n" rel="next">Password Database Functions</a>, Previous: <a href="Environment-Variables.html" accesskey="p" rel="prev">Environment Variables</a>, Up: <a href="System-Utilities.html" 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" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>