File: FTP-Objects.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 (211 lines) | stat: -rw-r--r-- 9,606 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
<!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>FTP Objects (GNU Octave (version 6.2.0))</title>

<meta name="description" content="FTP Objects (GNU Octave (version 6.2.0))">
<meta name="keywords" content="FTP Objects (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="Networking-Utilities.html" rel="up" title="Networking Utilities">
<link href="WWW-Access.html" rel="next" title="WWW Access">
<link href="Networking-Utilities.html" rel="prev" title="Networking Utilities">
<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="FTP-Objects"></span><div class="header">
<p>
Next: <a href="WWW-Access.html" accesskey="n" rel="next">WWW Access</a>, Up: <a href="Networking-Utilities.html" accesskey="u" rel="up">Networking 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="FTP-Objects-1"></span><h4 class="subsection">36.4.1 FTP Objects</h4>

<p>Octave supports the FTP protocol through an object-oriented interface.
Use the function <code>ftp</code> to create an FTP object which represents the
connection.  All FTP functions take an FTP object as the first argument.
</p>
<span id="XREF_0040ftp_002fftp"></span><dl>
<dt id="index-ftp">: <em><var>f</var> =</em> <strong>ftp</strong> <em>(<var>host</var>)</em></dt>
<dt id="index-ftp-1">: <em><var>f</var> =</em> <strong>ftp</strong> <em>(<var>host</var>, <var>username</var>, <var>password</var>)</em></dt>
<dd><p>Connect to the FTP server <var>host</var> with <var>username</var> and <var>password</var>.
</p>
<p>If <var>username</var> and <var>password</var> are not specified, user
<code>&quot;anonymous&quot;</code> with no password is used.  The returned FTP object
<var>f</var> represents the established FTP connection.
</p>
<p>The list of actions for an FTP object are shown below.  All functions
require an FTP object as the first argument.
</p>
<table>
<thead><tr><th width="15%">Method</th><th width="80%">Description</th></tr></thead>
<tr><td width="15%">ascii</td><td width="80%">Set transfer type to ascii</td></tr>
<tr><td width="15%">binary</td><td width="80%">Set transfer type to binary</td></tr>
<tr><td width="15%">cd</td><td width="80%">Change remote working directory</td></tr>
<tr><td width="15%">close</td><td width="80%">Close FTP connection</td></tr>
<tr><td width="15%">delete</td><td width="80%">Delete remote file</td></tr>
<tr><td width="15%">dir</td><td width="80%">List remote directory contents</td></tr>
<tr><td width="15%">mget</td><td width="80%">Download remote files</td></tr>
<tr><td width="15%">mkdir</td><td width="80%">Create remote directory</td></tr>
<tr><td width="15%">mput</td><td width="80%">Upload local files</td></tr>
<tr><td width="15%">rename</td><td width="80%">Rename remote file or directory</td></tr>
<tr><td width="15%">rmdir</td><td width="80%">Remove remote directory</td></tr>
</table>

</dd></dl>


<span id="XREF_0040ftp_002fclose"></span><dl>
<dt id="index-close-6">: <em></em> <strong>close</strong> <em>(<var>f</var>)</em></dt>
<dd><p>Close the FTP connection represented by the FTP object <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<span id="XREF_0040ftp_002fmget"></span><dl>
<dt id="index-mget">: <em></em> <strong>mget</strong> <em>(<var>f</var>, <var>file</var>)</em></dt>
<dt id="index-mget-1">: <em></em> <strong>mget</strong> <em>(<var>f</var>, <var>dir</var>)</em></dt>
<dt id="index-mget-2">: <em></em> <strong>mget</strong> <em>(<var>f</var>, <var>remote_name</var>, <var>target</var>)</em></dt>
<dd><p>Download a remote file <var>file</var> or directory <var>dir</var> to the local
directory on the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p>
<p>The arguments <var>file</var> and <var>dir</var> can include wildcards and any
files or directories on the remote server that match will be downloaded.
</p>
<p>If a third string argument <var>target</var> is given, then it must indicate
the path to the local destination directory.  <var>target</var> may be a
relative or absolute path.
</p></dd></dl>


<span id="XREF_0040ftp_002fmput"></span><dl>
<dt id="index-mput">: <em></em> <strong>mput</strong> <em>(<var>f</var>, <var>file</var>)</em></dt>
<dd><p>Upload the local file <var>file</var> into the current remote directory on the
FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the ftp function.
</p>
<p>The argument <var>file</var> is passed through the <code>glob</code> function and any
files that match the wildcards in <var>file</var> will be uploaded.
</p></dd></dl>


<span id="XREF_0040ftp_002fcd"></span><dl>
<dt id="index-cd">: <em></em> <strong>cd</strong> <em>(<var>f</var>)</em></dt>
<dt id="index-cd-1">: <em></em> <strong>cd</strong> <em>(<var>f</var>, <var>path</var>)</em></dt>
<dd><p>Get or set the remote directory on the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p>
<p>If <var>path</var> is not specified, return the remote current working
directory.  Otherwise, set the remote directory to <var>path</var> and return
the new remote working directory.
</p>
<p>If the directory does not exist, an error message is printed and the
working directory is not changed.
</p></dd></dl>


<span id="XREF_0040ftp_002fdir"></span><dl>
<dt id="index-dir">: <em><var>lst</var> =</em> <strong>dir</strong> <em>(<var>f</var>)</em></dt>
<dd><p>List the current directory in verbose form for the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<span id="XREF_0040ftp_002fascii"></span><dl>
<dt id="index-ascii">: <em></em> <strong>ascii</strong> <em>(<var>f</var>)</em></dt>
<dd><p>Set the FTP connection <var>f</var> to use ASCII mode for transfers.
</p>
<p>ASCII mode is only appropriate for text files as it will convert the
remote host&rsquo;s newline representation to the local host&rsquo;s newline
representation.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<span id="XREF_0040ftp_002fbinary"></span><dl>
<dt id="index-binary">: <em></em> <strong>binary</strong> <em>(<var>f</var>)</em></dt>
<dd><p>Set the FTP connection <var>f</var> to use binary mode for transfers.
</p>
<p>In binary mode there is no conversion of newlines from the remote
representation to the local representation.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<span id="XREF_0040ftp_002fdelete"></span><dl>
<dt id="index-delete-3">: <em></em> <strong>delete</strong> <em>(<var>f</var>, <var>file</var>)</em></dt>
<dd><p>Delete the remote file <var>file</var> over the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<span id="XREF_0040ftp_002frename"></span><dl>
<dt id="index-rename-2">: <em></em> <strong>rename</strong> <em>(<var>f</var>, <var>oldname</var>, <var>newname</var>)</em></dt>
<dd><p>Rename or move the remote file or directory <var>oldname</var> to <var>newname</var>,
over the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the ftp function.
</p></dd></dl>


<span id="XREF_0040ftp_002fmkdir"></span><dl>
<dt id="index-mkdir-5">: <em></em> <strong>mkdir</strong> <em>(<var>f</var>, <var>path</var>)</em></dt>
<dd><p>Create the remote directory <var>path</var>, over the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<span id="XREF_0040ftp_002frmdir"></span><dl>
<dt id="index-rmdir-3">: <em></em> <strong>rmdir</strong> <em>(<var>f</var>, <var>path</var>)</em></dt>
<dd><p>Remove the remote directory <var>path</var>, over the FTP connection <var>f</var>.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="WWW-Access.html" accesskey="n" rel="next">WWW Access</a>, Up: <a href="Networking-Utilities.html" accesskey="u" rel="up">Networking 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>