Currently I do
<foreach list="${myfolders}" target="bundle"
param="worksheet" inheritall="true"/>
to execute the target "bundle" on a list of folders. However the problem is I need to set this list. How do I use Ant to just loop through all the folders given the parent directory?
If there is a way to do this and also exclude specific folders that would be even better. Thanks.
You can provide a <dirset>
for the <foreach>
task to operate on:
<foreach target="bundle" param="worksheet" inheritall="true">
<path>
<dirset dir="${subDir}">
<include name="*"/>
</dirset>
</path>
</foreach>
Notice that the list
parameter isn't used when I do it this way.
You can't use <dirset>
directly under the <foreach>
as you can with <fileset>
. However, you can put the <dirset>
under the <path>
as shown above. The <include name="*"/>
prevents recursing down the directory tree.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With