我正在尝试将文件 test.txt 从文件所在的基目录移动到“输出”目标文件夹中。除了将文件 test.txt 复制到所需目录并从最初创建文件 test.txt 的基本目录中删除文件 test.txt 之外,还有其他方法吗?另请建议是否有任何替代方法可以使用 echo 标记来创建文件。
<target name="output">
<checksum file="${fileName}" property="md5"/>
<echo file="test.txt" append="true" message="${fileName} - ${md5}">${line.separator}</echo>
<copy file="test.txt" todir="output"/>
<delete file="test.txt" />
</target>
最佳答案
您可以使用以下命令来移动文件
<move file="a.txt" todir="Dir" />
或
<move todir="Dir">
<fileset dir="SourceDir/" />
</move >
关于java - Ant : moving a file into a target directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27420554/