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
|
<!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: FTP Objects</title>
<meta name="description" content="GNU Octave: FTP Objects">
<meta name="keywords" content="GNU Octave: FTP Objects">
<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="Networking-Utilities.html#Networking-Utilities" rel="up" title="Networking Utilities">
<link href="URL-Manipulation.html#URL-Manipulation" rel="next" title="URL Manipulation">
<link href="Networking-Utilities.html#Networking-Utilities" rel="prev" title="Networking Utilities">
<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="FTP-Objects"></a>
<div class="header">
<p>
Next: <a href="URL-Manipulation.html#URL-Manipulation" accesskey="n" rel="next">URL Manipulation</a>, Up: <a href="Networking-Utilities.html#Networking-Utilities" accesskey="u" rel="up">Networking 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="FTP-Objects-1"></a>
<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>
<a name="XREF_0040ftp_002fftp"></a><dl>
<dt><a name="index-ftp"></a>Function File: <em><var>f</var> =</em> <strong>ftp</strong> <em>(<var>host</var>)</em></dt>
<dt><a name="index-ftp-1"></a>Function File: <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>.
If <var>username</var> and <var>password</var> are not specified, user
<code>"anonymous"</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>
<a name="XREF_0040ftp_002fclose"></a><dl>
<dt><a name="index-close-4"></a>Function File: <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>
<a name="XREF_0040ftp_002fmget"></a><dl>
<dt><a name="index-mget"></a>Function File: <em></em> <strong>mget</strong> <em>(<var>f</var>, <var>file</var>)</em></dt>
<dt><a name="index-mget-1"></a>Function File: <em></em> <strong>mget</strong> <em>(<var>f</var>, <var>dir</var>)</em></dt>
<dt><a name="index-mget-2"></a>Function File: <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>. <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 argument <var>target</var> is given, then a single file or
directory will be downloaded to the local directory and the local name
will be changed to <var>target</var>.
</p></dd></dl>
<a name="XREF_0040ftp_002fmput"></a><dl>
<dt><a name="index-mput"></a>Function File: <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>. <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>
<a name="XREF_0040ftp_002fcd"></a><dl>
<dt><a name="index-cd-1"></a>Function File: <em></em> <strong>cd</strong> <em>(<var>f</var>)</em></dt>
<dt><a name="index-cd-2"></a>Function File: <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>
<a name="XREF_0040ftp_002fdir"></a><dl>
<dt><a name="index-dir"></a>Function File: <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>
<a name="XREF_0040ftp_002fascii"></a><dl>
<dt><a name="index-ascii"></a>Function File: <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.
ASCII mode is only appropriate for text files as it will convert
the remote host’s newline representation to the local host’s newline
representation.
</p>
<p><var>f</var> is an FTP object returned by the <code>ftp</code> function.
</p></dd></dl>
<a name="XREF_0040ftp_002fbinary"></a><dl>
<dt><a name="index-binary"></a>Function File: <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.
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>
<a name="XREF_0040ftp_002fdelete"></a><dl>
<dt><a name="index-delete-2"></a>Function File: <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>
<a name="XREF_0040ftp_002frename"></a><dl>
<dt><a name="index-rename-2"></a>Function File: <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>
<a name="XREF_0040ftp_002fmkdir"></a><dl>
<dt><a name="index-mkdir-3"></a>Function File: <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>
<a name="XREF_0040ftp_002frmdir"></a><dl>
<dt><a name="index-rmdir-3"></a>Function File: <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="URL-Manipulation.html#URL-Manipulation" accesskey="n" rel="next">URL Manipulation</a>, Up: <a href="Networking-Utilities.html#Networking-Utilities" accesskey="u" rel="up">Networking 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>
|