Written May 04, 2006 at 17:21 MDT Tagged agile and tools
Just got asked a question by Scott Cowan :
Q: is there a way in nant to run a call for each .sql file in a dir ?
A: If you wanted to execute the scripts for a whole directory of sql files (and the order of the files running is not important), then you can take advantage of the NAnt
<foreach item="File" property="filename">
<in>
<items basedir="${folder}">
<include name="*.sql"/>
</items>
</in>
<do>
<property name="target" value="${filename}"/>
<call target="exec.sql.template"/>
</do>
Notice that you would want to call this target from another target that sets the folder property to execute against:
<property name="folder" value="sql"/>
<call target="exec.sql.folder"/>
Hope this helps.
JP