paul.arzul writes (2006-12-20, 14:05:24):

>how do you select empty directories/folders? (a directory which has no files or
>folders in it?)

The following code uses <for> and <if> target from ant-contrib to list
empty dirs under project.dir:

    <for param="dir" >
      <dirset dir="${project.dir}" />
      <sequential>
        <pathconvert property="@{dir}.list" setonempty="no" >
          <path>
            <fileset dir="@{dir}" defaultexcludes="yes" />
          </path>
        </pathconvert>
        <if><not><isset property="@{dir}.list" /></not>
          <then>
            <echo message="@{dir} is empty" />
          </then>
        </if>
      </sequential>
    </for>

I set defaultexcludes to yes in the fileset spec to list empty dirs and dirs
containing only trash files.

HTH


--
Pascal Quesseveur, [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to