ant

Basic File IO

Write a file using echo

Simply specifying a file destination, echo will create, write, or append to a file.

<echo file=example.txt" append="false">
    hello world
</echo>

Print the contents of a file

To print the contents of a file, we can use loadfile to read a file into a local property, and then use echo to print the value of it.

<loadfile property="contents" srcFile="example.txt" />
<echo message="${contents}" />

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow