简体   繁体   English

在蚂蚁脚本中的copydir

[英]copydir in ant script

By using following ant script all the files will be copied from source.dir to build.dir 通过使用以下ant脚本,所有文件将从source.dir复制到build.dir

<target name="compile" description="">
        <copy todir="${build.dir}">                                          
            <fileset dir="${source.dir}"/>
        </copy>
    </target>

means: 手段:

source/
  1.html
  2.html
  html/
   3.html
   4.html

build/
  1.html
  2.html
  html/
   3.html
   4.html

I want the following 我想要以下内容

source/
  1.html
  2.html
  html/
   3.html
   4.html

build/
  1.html
  2.html     
  3.html
  4.html

Can anyone help me out here, i am new in ant script! 任何人都可以帮助我,我是蚂蚁脚本的新手!

If you want to manipulate the file names as you copy, copy you need a mapper 如果要在复制时操作文件名,请复制,您需要一个映射器

    <copy todir="${build.dir}">                                          
        <fileset dir="${source.dir}"/>
        <flattenmapper/>
    </copy>

Use Ant Move Tag 使用Ant移动标记

Here is an example.. 这是一个例子..

<move file="file.orig" todir="dir/to/move/to"/>

For multiple files ... 对于多个文件......

  <move todir="some/new/dir">
    <filelist dir="my/src/dir">
      <file name="file1.txt"/>
      <file name="file2.txt"/>
    </filelist>
  </move>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM