Common commands for Ant getting started, ant getting started

Source: Internet
Author: User
Tags echo command echo message

Common commands for Ant getting started, ant getting started
I. copy command

Copy is mainly used to copy files and directories. Example:

Example 1. Copy a single file:

<copy file="A.txt" tofile="B.txt"/>

Example 2. copy the file directory:

<copy todir="dest_dir">    <fileset dir="src_dir"/></copy>

Example 3. copy the file to another directory

<copy file="source.txt" todir="dest_dir"/>


Ii. delete command

Delete a file or directory. Example:

Example 1. delete an object:

<delete file="A.txt"/>

Example 2. delete a directory:

<delete dir="home/src"/>

Example 3: delete all backup directories or empty directories:

<delete includeEmptyDirs="true">       <fileset dir="." includes="**/*.bak"/></delete>


Iii. mkdir command

Create directory:

<mkdir dir="home/src/bin"/>


Iv. move command

Move a file or directory. Example:

Example 1. Move a single file:

<move file="source_file" tofile=”dest_file”/>

Example 2. Move a single file to another directory:

<move file="source_file" todir=”move_dir”/>

Example 3. Move a directory to another directory:

<move todir="new_dir">     <fileset dir="old_dir"/></move>


5. echo command

This task outputs Information Based on the log or monitor level.

It includes four attributes: message, file, append, and level. The example is as follows:

<echo message="hello ant" file="home/msg.log" append="true" />


Author: itmyhome
Original article: wheat field technical blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.