ant 自动下传

ant 自动上传target nameupload description上传remote目录的内容到服务器上 !--登录到服务器,创

ant 自动上传
<target name="upload" description="上传remote目录的内容到服务器上" >
        <!--登录到服务器,创建远程工作目录 -->
        <telnet server="${host}" userid="${username}" password="${password}" timeout="600">
            <read>${host.prompt}</read>
            <write>rm -r ${ci.remote.workdir}</write>
            <read>${host.prompt}</read>
            <write>mkdir -p ${ci.remote.workdir}</write>
            <read>${host.prompt}</read>
        </telnet>
       
        <!--使用FTP上传二进制文件到服务器 -->
        <ftp action="send" server="${host}" userid="${username}" password="${password}" remotedir="${ci.remote.workdir}" binary="yes">
            <fileset dir="${local.remote.dir}" >
                <exclude name="**/*.sh" />
                <exclude name="**/*.jsp" />
            </fileset>

        </ftp>

<!--下载tar.gz包-->

<ftp action="get" server="${host}" userid="${username}" password="${password}" remotedir="${host.remote.dir}/${basefilename}" binary="yes">
                <fileset dir="@{destdir}" includes="@{targzfile}" />
            </ftp>
</target>