Common commands for the ant Getting Started tutorial

Source: Internet
Author: User
Tags echo command

One, copy command

Copy is primarily used for copying files and directories. Examples are as follows:

Example 1. To copy a single file:

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

Example 2. To copy a file directory:

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

Example 3. Copy files to a different directory

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


Second, delete command

Delete the file or directory. Examples are as follows:

Example 1. Delete a file:

<delete file="A.txt"/>

Example 2. To 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 Order

To create a directory:

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


Iv. Move Command

Move a file or directory. Examples are as follows:

Example 1. To move a single file:

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

Example 2. To move a single file to another directory:

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

Example 3. To move a directory to another directory:

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


V. Echo command

The purpose of this task is to output information based on the level of the log or monitor.

It includes the message, file, append, and level four properties, as in the following example

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


Author: itmyhome
Original: Wheat Field Technology Blog

Common commands for the ant Getting Started tutorial

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.