Abe Miessler
Abe Miessler

Reputation: 85116

How to echo the contents of a fileset in Nant?

Was trying to do something like this:

<copy>  
        <fileset id="mySet">
        <include name="*.sql" />
    </fileset>
</copy>
<echo message="Copied files: ${mySet} to directory: ${Folder}." />

But i get the following error:

'id' is an invalid attribute for a tag. Datatypes can only be declared at Project or Target level. Thanks

Upvotes: 3

Views: 3180

Answers (1)

The Chairman
The Chairman

Reputation: 7187

You can do this by looping over the files in the set.

<fileset id="mySet">
  <include name="*.sql" />
</fileset>
<copy>  
  <fileset refid="mySet" />
</copy>
<foreach item="File" property="filename">
  <in>
    <items refid="mySet" />
  </in>
  <do>
    <echo message="Copied files: ${filename} to directory: ${Folder}." />
  </do>
</foreach>

But depending on verbosity level the result of the copy action is echoed anyway.

Upvotes: 8

Related Questions