You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "P.N." <pe...@gmx.de> on 2010/09/03 16:27:37 UTC
How to get the last folder name?
Hello!
I want to get the path to the last child folder in some parent
directory. Tried this:
<path id="_lastname">
<last>
<sort>
<fileset dir="C:\my\parent"/>
</sort>
</last>
</path>
<property name="_lastname2" location="${_lastname}"/>
<echoproperties/>
Doesn't work :-(
I'd also like to get the last one of a collection of folders, e.g.
C:\my\parent\xyz*
It seems, there're so many filters and tasks, I'd guess it should be
possible somehow - any good solution?
Thank You in advance
P.N.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: How to get the last folder name?
Posted by "P.N." <pe...@gmx.de>.
Thank You! Works fine, now!!!
Regards
Peter
Matt Benson schrieb:
>
> On Sep 3, 2010, at 9:45 AM, P.N. wrote:
>
>> Thank You! Works partly, as it returns the last child in the last subfolder instead of the last direct child.
>>
>> Also,<fileset> seems not to be the correct element for matches (e.g. "xy*").
>>
>
> To get directories only, use a dirset. To get direct children only, use includes="*".
>
> -Matt
>
>> Regards
>>
>> Peter
>>
>>
>> Matt Benson schrieb:
>>> Your example should work if you only use ${toString:_lastname}. References are not properties.
>>>
>>> HTH,
>>> Matt
>>>
>>> On Sep 3, 2010, at 9:27 AM, P.N. wrote:
>>>
>>>>
>>>> Hello!
>>>>
>>>> I want to get the path to the last child folder in some parent directory. Tried this:
>>>>
>>>> <path id="_lastname">
>>>> ...
>>
>>
>> ---------------------------------------------------------------------
>> 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
Re: How to get the last folder name?
Posted by Matt Benson <gu...@gmail.com>.
On Sep 3, 2010, at 9:45 AM, P.N. wrote:
> Thank You! Works partly, as it returns the last child in the last subfolder instead of the last direct child.
>
> Also, <fileset> seems not to be the correct element for matches (e.g. "xy*").
>
To get directories only, use a dirset. To get direct children only, use includes="*".
-Matt
> Regards
>
> Peter
>
>
> Matt Benson schrieb:
>> Your example should work if you only use ${toString:_lastname}. References are not properties.
>>
>> HTH,
>> Matt
>>
>> On Sep 3, 2010, at 9:27 AM, P.N. wrote:
>>
>>>
>>> Hello!
>>>
>>> I want to get the path to the last child folder in some parent directory. Tried this:
>>>
>>> <path id="_lastname">
>>> ...
>
>
> ---------------------------------------------------------------------
> 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
Re: How to get the last folder name?
Posted by "P.N." <pe...@gmx.de>.
Thank You! Works partly, as it returns the last child in the last
subfolder instead of the last direct child.
Also, <fileset> seems not to be the correct element for matches (e.g.
"xy*").
Regards
Peter
Matt Benson schrieb:
> Your example should work if you only use ${toString:_lastname}. References are not properties.
>
> HTH,
> Matt
>
> On Sep 3, 2010, at 9:27 AM, P.N. wrote:
>
>>
>> Hello!
>>
>> I want to get the path to the last child folder in some parent directory. Tried this:
>>
>> <path id="_lastname">
>>...
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: How to get the last folder name?
Posted by Matt Benson <gu...@gmail.com>.
Your example should work if you only use ${toString:_lastname}. References are not properties.
HTH,
Matt
On Sep 3, 2010, at 9:27 AM, P.N. wrote:
>
> Hello!
>
> I want to get the path to the last child folder in some parent directory. Tried this:
>
> <path id="_lastname">
> <last>
> <sort>
> <fileset dir="C:\my\parent"/>
> </sort>
> </last>
> </path>
> <property name="_lastname2" location="${_lastname}"/>
> <echoproperties/>
>
> Doesn't work :-(
>
> I'd also like to get the last one of a collection of folders, e.g.
> C:\my\parent\xyz*
>
> It seems, there're so many filters and tasks, I'd guess it should be possible somehow - any good solution?
>
> Thank You in advance
>
> P.N.
>
>
> ---------------------------------------------------------------------
> 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