簡體   English   中英

在螞蟻腳本中的copydir

[英]copydir in ant script

通過使用以下ant腳本,所有文件將從source.dir復制到build.dir

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

手段:

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

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

我想要以下內容

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

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

任何人都可以幫助我,我是螞蟻腳本的新手!

如果要在復制時操作文件名,請復制,您需要一個映射器

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

使用Ant移動標記

這是一個例子..

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

對於多個文件......

  <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