mirror of
https://github.com/apache/ant.git
synced 2025-05-18 22:14:47 +00:00
(1) Make sure there is a Copyright notice on all visible files. (2) Make sure all years in which the file has been modified are listed. (3) Make sure the format is consistent, i.e. separate consecutive years with a dash, not a comma. When Stephane changed starteam.html it has been 2001 in France but 2002 in Australia - does that mean we add 2002 to the Copyright line or not? ;-) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270652 13f79535-47bb-0310-9956-ffa450edef68
260 lines
10 KiB
HTML
260 lines
10 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
<title>Apache Ant User Manual</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h2><a name="ftp">FTP</a></h2>
|
|
<h3>Description</h3>
|
|
<p>The ftp task implements a basic FTP client that can send, receive,
|
|
list, delete files, and create directories. See below for descriptions and examples of how
|
|
to perform each task.</p>
|
|
<p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
|
|
See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
|
|
<p>The ftp task makes no attempt to determine what file system syntax is
|
|
required by the remote server, and defaults to Unix standards.
|
|
<i>remotedir</i> must be specified in the exact syntax required by the ftp
|
|
server. If the usual Unix conventions are not supported by the server,
|
|
<i>separator</i> can be used to set the file separator that should be used
|
|
instead.</p>
|
|
<p>See the section on <a href="../dirtasks.html#directorybasedtasks">directory based
|
|
tasks</a>, on how the inclusion/exclusion of files works, and how to
|
|
write patterns.</p>
|
|
<p>
|
|
<b>Warning: </b> for the get and delete actions to work properly
|
|
with a Windows 2000 ftp server, it needs to be configured to generate
|
|
Unix style listings, and not the default MS-DOS listing. Or someone needs to write
|
|
the code to parse MS-DOS listings -any takers?
|
|
<h3>Parameters</h3>
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><b>Attribute</b></td>
|
|
<td valign="top"><b>Description</b></td>
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">server</td>
|
|
<td valign="top">the address of the remote ftp server.</td>
|
|
<td valign="top" align="center">Yes</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">port</td>
|
|
<td valign="top">the port number of the remote ftp server.
|
|
Defaults to port 21.</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">userid</td>
|
|
<td valign="top">the login id to use on the ftp server.</td>
|
|
<td valign="top" align="center">Yes</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">password</td>
|
|
<td valign="top">the login password to use on the ftp server.</td>
|
|
<td valign="top" align="center">Yes</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">remotedir</td>
|
|
<td valign="top">the directory to which to upload files on the
|
|
ftp server.</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">action</td>
|
|
<td valign="top">the ftp action to perform, defaulting to "send".
|
|
Currently supports "put", "get",
|
|
"del", "list" and "mkdir".</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">binary</td>
|
|
<td valign="top">selects binary-mode ("yes") or text-mode
|
|
("no") transfers.
|
|
Defaults to "yes"</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">passive</td>
|
|
<td valign="top">selects passive-mode ("yes") transfers.
|
|
Defaults to "no"</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">verbose</td>
|
|
<td valign="top">displays information on each file transferred if set
|
|
to "yes". Defaults to "no".</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">depends</td>
|
|
<td valign="top">transfers only new or changed files if set to
|
|
"yes". Defaults to "no".</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">newer</td>
|
|
<td valign="top">a synonym for <i>depends</i>.</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">separator</td>
|
|
<td valign="top">sets the file separator used on the ftp server.
|
|
Defaults to "/".</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">listing</td>
|
|
<td valign="top">the file to write results of the "list" action.
|
|
Required for the "list" action, ignored otherwise.</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">ignoreNoncriticalErrors</td>
|
|
<td valign="top">flag which permits the task to ignore some non-fatal error
|
|
codes sent by some servers during directory creation: wu-ftp in particular.
|
|
Default: false</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">skipFailedTransfers</td>
|
|
<td valign="top">flag which enables unsuccessful file put, delete
|
|
and get operations to be skipped with a warning and the
|
|
remainder of the files still transferred. Default: false</td>
|
|
<td valign="top" align="center">No</td>
|
|
</tr>
|
|
</table>
|
|
<h3>Sending Files</h3>
|
|
<p>The easiest way to describe how to send files is with a couple of examples:</p>
|
|
<pre>
|
|
<ftp server="ftp.apache.org"
|
|
userid="anonymous"
|
|
password="me@myorg.com">
|
|
<fileset dir="htdocs/manual"/>
|
|
</ftp>
|
|
</pre>
|
|
<p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
|
|
uploads all files in the <code>htdocs/manual</code> directory
|
|
to the default directory for that user.</p>
|
|
<pre> <ftp server="ftp.apache.org"
|
|
remotedir="incoming"
|
|
userid="anonymous"
|
|
password="me@myorg.com"
|
|
depends="yes"
|
|
>
|
|
<fileset dir="htdocs/manual"/>
|
|
</ftp></pre>
|
|
<p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
|
|
uploads all new or changed files in the <code>htdocs/manual</code> directory
|
|
to the <code>incoming</code> directory relative to the default directory
|
|
for <code>anonymous</code>.</p>
|
|
<pre> <ftp server="ftp.apache.org"
|
|
port="2121"
|
|
remotedir="/pub/incoming"
|
|
userid="coder"
|
|
password="java1"
|
|
depends="yes"
|
|
binary="no"
|
|
>
|
|
<fileset dir="htdocs/manual">
|
|
<include name="**/*.html"/>
|
|
</fileset>
|
|
</ftp></pre>
|
|
<p>Logs in to <code>ftp.apache.org</code> at port <code>2121</code> as
|
|
<code>coder</code> with password <code>java1</code> and uploads all new or
|
|
changed HTML files in the <code>htdocs/manual</code> directory to the
|
|
<code>/pub/incoming</code> directory. The files are transferred in text mode. Passive mode has been switched on to send files from behind a firewall.</p>
|
|
<pre> <ftp server="ftp.nt.org"
|
|
remotedir="c:\uploads"
|
|
userid="coder"
|
|
password="java1"
|
|
separator="\"
|
|
verbose="yes"</pre>
|
|
<PRE>
|
|
>
|
|
<fileset dir="htdocs/manual">
|
|
<include name="**/*.html"/>
|
|
</fileset>
|
|
</ftp></PRE><p>Logs in to the Windows-based <code>ftp.nt.org</code> as
|
|
<code>coder</code> with password <code>java1</code> and uploads all
|
|
HTML files in the <code>htdocs/manual</code> directory to the
|
|
<code>c:\uploads</code> directory. Progress messages are displayed as each
|
|
file is uploaded.</p>
|
|
<h3>Getting Files</h3>
|
|
<p>Getting files from an FTP server works pretty much the same way as
|
|
sending them does. The only difference is that the nested filesets
|
|
use the remotedir attribute as the base directory for the files on the
|
|
FTP server, and the dir attribute as the local directory to put the files
|
|
into. The file structure from the FTP site is preserved on the local machine.</p>
|
|
<pre>
|
|
<ftp action="get"
|
|
server="ftp.apache.org"
|
|
userid="anonymous"
|
|
password="me@myorg.com">
|
|
<fileset dir="htdocs/manual" >
|
|
<include name="**/*.html"/>
|
|
</fileset>
|
|
</ftp>
|
|
</pre>
|
|
<p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
|
|
recursively downloads all .html files from default directory for that user
|
|
into the <code>htdocs/manual</code> directory on the local machine.</p>
|
|
.
|
|
<h3>Deleting Files</h3>
|
|
As you've probably guessed by now, you use nested fileset elements to
|
|
select the files to delete from the remote FTP server. Again, the
|
|
filesets are relative to the remote directory, not a local directory. In
|
|
fact, the dir attribute of the fileset is ignored completely.
|
|
|
|
<pre>
|
|
<ftp action="del"
|
|
server="ftp.apache.org"
|
|
userid="anonymous"
|
|
password="me@myorg.com" >
|
|
<fileset>
|
|
<include name="**/*.tmp"/>
|
|
</fileset>
|
|
</ftp>
|
|
</pre>
|
|
<p>Logs in to <code>ftp.apache.org</code> as <code>anonymous</code> and
|
|
tries to delete all *.tmp files from the default directory for that user.
|
|
If you don't have permission to delete a file, a BuildException is thrown.</p>
|
|
<h3>Listing Files</h3>
|
|
<pre>
|
|
<ftp action="list"
|
|
server="ftp.apache.org"
|
|
userid="anonymous"
|
|
password="me@myorg.com"
|
|
listing="data/ftp.listing" >
|
|
<fileset>
|
|
<include name="**"/>
|
|
</fileset>
|
|
</ftp>
|
|
</pre>
|
|
<p>This provides a file listing in <code>data/ftp.listing</code> of all the files on
|
|
the FTP server relative to the default directory of the <code>anonymous</code>
|
|
user. The listing is in whatever format the FTP server normally lists files.</p>
|
|
|
|
<h3>Creating Directories</h3>
|
|
<p>Note that with the mkdir action, the directory to create is specified using the
|
|
remotedir attribute.</p>
|
|
<pre>
|
|
<ftp action="mkdir"
|
|
server="ftp.apache.org"
|
|
userid="anonymous"
|
|
password="me@myorg.com"
|
|
remotedir="some/remote/dir" />
|
|
</pre>
|
|
<p>This creates the directory <code>some/remote/dir</code> beneath the default root
|
|
directory. As with all other actions, the directory separator character must be correct
|
|
according to the desires of the FTP server.</p>
|
|
<hr>
|
|
<p align="center">Copyright © 2001 Apache Software Foundation. All rights
|
|
Reserved.</p>
|
|
|
|
</body>
|
|
</html>
|
|
|