1.copy命令:
<?xml version="1.0" encoding="utf-8"?> <project name="copyFile" default="copyToOtherPath"> <!-- 复制单个文件--> <target name="copyTaget"> <copy file="mmmt.txt" tofile="99t.txt"/> </target> <!-- 复制目录--> <target name="copyDir"> <copy todir="test3"> <fileset dir= "test"/> </copy> </target> <!-- 复制单个文件到另一个目录 --> <target name="copyToOtherPath"> <copy file="mmmt.txt" todir="project"/> </target> </project>
delete命令:
<?xml version="1.0" encoding="utf-8"?> <project name="deletePro" default="deleteAllData"> <!--删除单个文件--> <target name="deleteFile"> <delete file="99t.txt"/> </target> <!--删除目录--> <target name="deletePath"> <delete dir="test3"/> </target> <!--删除缓存 --> <target name="deleteAllData"> <delete includeEmptyDirs="true"> <fileset dir="." includes="**/*.bak"/> </delete> </target> </project>
mkdir创建目录:
<?xml version="1.0" encoding="utf-8"?> <project name="deletePro" default="makeDir"> <target name="makeDir"> <mkdir dir="bbs"/> </target> </project>
move移动文件或目录
<?xml version="1.0" encoding="utf-8"?> <project name="deletePro" default="moveFileToOtherPath"> <target name="moveFile"> <move file="testskin.txt" tofile="99uy.txt"/> </target> <target name="moveFileToOtherPath"> <move file="testskin.txt" todir="movedir"/> </target> </project>