Ant复制文件
1 <?xml version="1.0" encoding="UTF-8"?> 2 <project name ="test" default="copy" basedir="."> 3 <target name ="copy"> 4 <!--拷贝一个文件 --> 5 <copy file ="myfile.txt" tofile="mycopy.txt"/> 6 7 <!--拷贝一个文件到指定目录 --> 8 <copy file ="myfile.txt" todir="other"/> 9 10 <!-- 拷贝一个目录到另一个目录 --> 11 <copy todir="other"> 12 <fileset dir="bin"/> 13 </copy> 14 15 <!-- 拷贝一个文件集到另一个目录 --> 16 <copy todir="other"> 17 <fileset dir="bin"> 18 <!-- 排除所有的.java文件 --> 19 <exclude name="**/*.java"/> 20 </fileset> 21 </copy> 22 23 <!-- 拷贝一个文件集到另一个目录,同时建立备份文件--> 24 <copy todir="other"> 25 <fileset dir="bin" /> 26 <globmapper from="*" to="*.bak"/> 27 </copy> 28 29 <!-- 使用copydir拷贝一个目录下的东西到另一个目录,includes包含,excludes排除(已过时) --> 30 <copydir src="bin" 31 dest="other" 32 includes="**/*.java" 33 excludes="**/Test.java" 34 /> 35 36 <!-- 使用copyfile拷贝一个文件(已过时)--> 37 <copyfile src ="test.java" dest="other/test.java"/> 38 </target> 39 </project>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步