ant学习记录(复制-移动-删除-依赖综合测试)+fileset

<?xml version="1.0"?>



<project name="targetStudy" default="mkdir">

<target name="mkdir" description="新建目录">

	<mkdir dir="newdir"/>

</target>

<target name="copyFile" description="复制文件" depends="mkdir">

	<copy file="jsp.doc" tofile="jspcopy.doc"/>

</target>

<target name="moveFile" description="移动文件" depends="copyFile">

	<move file="jspcopy.doc" tofile="newdir/jspcopy.doc"/>

</target>

<target name="mkdir1" description="新建第二个目录" depends="moveFile">

	<mkdir dir="newdir1"/>

</target>

<target name="movedir" description="移动目录" depends="mkdir1">

	<move todir="newdir1">

	<fileset dir="newdir"/>

	</move>

</target>



</project>	

fileset:一组文件(或文件集)

可以对文件进行筛选

<fileset dir="${dir}" includes="**/*.jar">

<date datetime="01/01/2001 12:00AM" when="before"/>

<size value="4" units="Ki" when="more"/>

<include name="**/*.java"/>

<exclude name="**/*.class"/>

</fileset>

 对时间2001 0101 12点    大小4k    文件类型进行了筛选

 

 

<?xml version="1.0"?>



<project name="targetStudy">

<target name="deletedir" description="删除目录">

	<delete dir="newdir1"/>

</target>

</project>	

  

你可能感兴趣的:(File)