Ant : moving a file into a target directory

I am trying to move the file test.txt into the ‘output’ target folder from the base directory where the file exists. Is there any other way other than copying the file test.txt to the required directory and deleting the file test.txt from the base directory, where it has been originally created. Also please suggest if there is any alternative to use echo tag to create the file.

<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" />


You can use below command to move file

<move file="a.txt" todir="Dir" />


<move todir="Dir"> <fileset dir="SourceDir/" /> </move >

Leave a Reply

Your email address will not be published. Required fields are marked *