ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Medeiros <>
Subject Re: How to echo the empty directories of a fileset ?
Date Wed, 19 May 2010 17:17:12 GMT
On Mon, May 17, 2010 at 4:06 PM, Matt Benson <> wrote:
> On May 15, 2010, at 4:30 AM, Bruno Medeiros wrote:
>> On Thu, May 13, 2010 at 7:14 PM, Matt Benson <> wrote:
>>> On May 13, 2010, at 12:48 PM, Bruno Medeiros wrote:
>>>> Hello. If I do something like this:
>>>>       <copy todir="${destination.dir}" verbose="true" >
>>>>               <fileset dir="${projects.dir}/" >
>>>>                       <include name="*" />
>>>>               </fileset>
>>>>       </copy>
>>>> and projects.dir has some empty directories, then those directories
>>>> will be copied to destination.dir .
>>>> Is this normal behavior? (It seems strange to me that a fileset would
>>>> contain empty directories)
>>>> And if that's the case, how can I echo the empty directories of a
>>>> fileset? I am familiar with this:
>>>>       <pathconvert refid="my.fileset" property="my.files.list">
>>>> pathsep=","/>
>>>>       <echo message="${my.files.list}"/>
>>>> But it only prints the files of the fileset, not the directories.
>>> If you simply want to copy a fileset and not get empty directories,
>>> <copy>
>>> has an includeemptydirs attribute which defaults to true.
>>> -Matt
>> The copy code is fine and is just to exemply how I found this fileset
>> behavior.
>> What I want to know is exactly what the title says, how can I echo the
>> empty directories of a fileset? That is possible, right?
> Anything is possible... :)  Off the top of my head nothing simple springs to
> mind.  The easiest thing would probably be to write a custom selector (you
> can script them, if memory serves) to select directories with no children.
> A hack would be to copy a structure without including empty directories,
> then compare for relative paths that exist in the source structure and not
> the target structure, but that seems a little heavy to me in terms of
> processing required.
> HTH,
> Matt

I meant possible in a straightforward, direct way. As I suspected, I
guess its not possible: it seems this knowledge that <fileset> has of
empty directories is kinda of a hidden thing that only <copy> (and
perhaps a few other tasks) can make use of.
That being the case, I would rather not try to workaround this quirk,
I'll rather use the other resource types instead, which hopefully are
"purer" in behavior. I took a better look at them, and it seems
wrapping a <fileset> around a <resources> removes the quirky behavior
(ie, keeping the hidden empty directories), so that's good enough for

Thx anyway,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message