tags:

views:

240

answers:

1

I'm looking for my build to delete the contents of a directory without touching a certain folder. Below is what I'm trying, and it even looks wrong to me...aside from the fact that it bombs when I run it. Do I need to be deleting the contents of the dir explicitly and at the same time exclude my Reports folder?

<delete includeemptydirs="true">
      <fileset dir="${PublishLocation}" >
        <exclude name="**Reports**"/>
      </fileset>
    </delete>

Cheers.

+4  A: 

It should be:

<delete>
  <fileset basedir="${PublishLocation}">
    <include name="**/*"/>
    <exclude name="**/Reports/**/*" />
  </fileset>
</delete>

Please notice the following:

  • includeemptydirs="true" is default
  • The attribute for fileset is basedir instead of dir
  • if you specify <exclude name="**/Reports/**" /> instead of <exclude name="**/Reports/**/*" /> all files named Reports are kept as well
The Chairman
Thanks to much. Moving the reports was making the build to the server take over 60 minutes, not it's down to 2. Cheers!
BryanGrimes