ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: How to echo the empty directories of a fileset ?
Date Mon, 17 May 2010 15:06:48 GMT

On May 15, 2010, at 4:30 AM, Bruno Medeiros wrote:

> On Thu, May 13, 2010 at 7:14 PM, Matt Benson <gudnabrsam@gmail.com>  
> 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

>
> Bruno
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message