The files and directories are mirrored according to these rules:
| Local | Remote | Action |
| file exists | file exists | check date & overwrite remote file if necessary |
| file exists | dir exists | delete remote directory tree; send local file to remote |
| dir exists | file exists | delete remote file; create remote directory |
| dir exists | dir exists | no action |
| file exists | -- | send local file to remote |
| dir exists | -- | create remote directory |
| -- | file exists | delete remote file |
| -- | dir exists | delete remote directory tree |
Here's the simplest target:
<!-- ==================================== -->
<property name="root.local" value="d:/web/domain"/>
<property name="root.remote" value="domain"/>
<!-- ==================================== -->
<target name="web">
<ftpmirror server="${url}" userid="${uid}" password="${pwd}" >
<local dir="${root.local}/html" />
<remote dir="${root.remote}/html" />
</ftpmirror>
</target>
This build.xml target would do the following:
Here's a sample with a remote exclusion:
<!-- ==================================== -->
<target name="web">
<ftpmirror server="${url}" userid="${uid}" password="${pwd}" >
<local dir="${root.local}/html" />
<remote dir="${root.remote}/html" >
<exclude name="stats/"/>
</remote>
</ftpmirror>
</target>
This target indicates the ~/domain/html/stats directory is to be ignored in all processing.
Here's a little more complicated sample:
<!-- ==================================== -->
<target name="web">
<ftpmirror server="${url}" userid="${uid}" password="${pwd}" >
<local dir="${root.local}" >
<include name="."/>
<include name="html/"/>
<include name="cgi-bin/"/>
</local>
<remote dir="${root.remote}" >
<include name="."/>
<include name="html/"/>
<include name="cgi-bin/"/>
<exclude name="stats/"/>
<exclude name="html/logs/"/>
<exclude name="cgi-bin/access.db" />
<exclude name="cgi-bin/auth/" />
</remote>
</ftpmirror>
</target>
This sample shows that in the local current directory there are two directories that will be included in the transfer: html and cgi-bin. The trailing '/' causes the entire directory tree to be included. Note there may be other files and sub-directories in the ${root.local} but they are not included therefore excluded from the processing.
The same subdirectories html and cgi-bin are included in the remote tree. But there
is a stats subdirectory that is excluded. Also there is a logs subdirectory in the
html directory treee that is to be excluded. In cgi-bin there is a file access.db to
be excluded and a subdirectory auth as well.
| Contact me about content on this page using john_web-at-arrizza-dot-com |
| For Web Master or site problems contact: webadmin-at-arrizza-dot-com |
| Copyright John Arrizza (c) 2001,2002,2003,2004,2005,2006,2007 |