开发者

copy subfolders to a directory using ant

开发者 https://www.devze.com 2022-12-20 05:50 出处:网络
I want to copy a lot of subfolders and its content from various other folders to one specific folder.

I want to copy a lot of subfolders and its content from various other folders to one specific folder. I also want to use a patternset to choose the subfolders to copy. For example there may be a folder wich contains a lots of subfolders which then could contain again subfolders. Now I want a patternset to get all folders named org or com or whatever and copy them where I like. I tried it this way:

<target name="copysrc">
  <patternset id="set">
    <include name="**/org/**"/>
    <include name="**/com/**"/>
    <include name="**/de/**"/>
    <include name="**/net/**"/>
  </patternset>
  <copy todir="${tmp.dir2}">
    <fileset dir="${tmp.dir}" casesensitive="no">
      <patternset refid="set" />
    </fileset>
  </copy>
</target>

Almost did the trick but I still have all the folders above the o开发者_Go百科rg, com,... copied with them and not just org, com,.. and the contend below these folders.

Thanks in advance, mojoo.de


Okay got it working now .. had to use the ant contrib package code looks like

<target name="copysrc">
<patternset id="zuKopieren">
<include name="org/**"/>
<include name="com/**"/>
<include name="de/**"/>
<include name="net/**"/>
</patternset>
<for param="verzeichnisName">
<dirset dir="${tmp.dir}"></dirset>
<sequential> 
<copy todir="${tmp.dir2}/src">
<fileset dir="@{verzeichnisName}" casesensitive="no"><patternset refid="zuKopieren" />
</fileset>
</copy>
</sequential>
</for>
</target>
0

精彩评论

暂无评论...
验证码 换一张
取 消