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>
精彩评论