ant中ftp上传下载删除的用法
下载文件:
<!-- 将154上最新编译的FTP资源SWF文件复制到本地目录-->
<target name="ftpSwfToLocal">
<ftp action="get"
server="10.45.7.154"
userid="devflex"
password="smart"
remotedir="/ztesoft/devflex/java/webportal/WebContent/i18n/en_US/">
<fileset dir="d:/javaWorkspace/cvbs/WebContent/i18n/en_US">
<include name="**/*swf"/>
</fileset>
</ftp>
<echo message = "d:/javaWorkspace/cvbs/WebContent/i18n/en_US ---> ftpGet"/>
</target>
问题1、报错找不到“Could not create type ftp due to java.lang.NoClassDefFoundError:
org/apache/commons/net/ftp/FTPClientConfig”
解决:少了两个包:commons-net-1.4.1.jar和jakarta-oro-2.0.8.jar
将这两个包加入到

 
<!--action不指定默认就是上传-->
<target name= "ftp.upload">
  <ftp server="xxx.xx.10.49"s
       userid="anonymous"
       password="[email protected]"
      remotedir="/second">
    <fileset dir=".">
      <include name="*.apk"/>
    </fileset>
  </ftp>
</target>
<!--假如要download的文件夹没有文件,那么空文件夹不会下载下来,删除同理-->
<target name= "ftp.download">
  <ftp action="get"
  server="xxx.xx.10.49"
       userid="anonymous"
       password="[email protected]"
  remotedir="second">
    <fileset dir="second">
  <include name="**"/> 
    </fileset>
  </ftp>
</target>
<target name= "ftp.del">
  <ftp action="del"
    server="xxx.xx.10.49"
        userid="anonymous"
       password="[email protected]" > 
   <fileset dir="second">    
   </fileset>
  </ftp>
</target>
