You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nat Gross <na...@verizon.net> on 2005/01/25 22:43:49 UTC

Last element of current directory name.

How do I get just the last element of the current directory.
Suppose basedir = dira/dirb/dirc. (Or any path for that matter.)

I need a property to = "Dirc". (1st character uppercased, if possible.)

For the pros out there it should be 123, but for me... forget it!

Thanks
-nat

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


Re: Last element of current directory name.

Posted by Nat Gross <na...@verizon.net>.
Matt Benson wrote:

>--- Nat Gross <na...@verizon.net>
>wrote:
>
>  
>
>>How do I get just the last element of the current
>>directory.
>>Suppose basedir = dira/dirb/dirc. (Or any path for
>>that matter.)
>>    
>>
>
>Whatever is "the current directory"--${user.dir}?
>${basedir}?... You can use the basename task to get
>the last element of a path.
>  
>
I have used basename for filenames without realizing that it also works 
for directory names.
Thanks.

>>I need a property to = "Dirc". (1st character
>>uppercased, if possible.)
>>
>>    
>>
>Changing case is more problematical.  I would either
>try ant-contrib's propertyregex (though I'm not good
>with changing case in regular expressions either),
>write something in Java, or deal with the case as-is. 
>Others might use a script.
>  
>
Thanks. I need to explore regex, I guess.

>>For the pros out there it should be 123, but for
>>me... forget it!
>>    
>>
>
>HTH,
>Matt
>  
>
>>Thanks
>>-nat
>>    
>>

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


Re: Last element of current directory name.

Posted by Matt Benson <gu...@yahoo.com>.
--- Nat Gross <na...@verizon.net>
wrote:

> How do I get just the last element of the current
> directory.
> Suppose basedir = dira/dirb/dirc. (Or any path for
> that matter.)

Whatever is "the current directory"--${user.dir}?
${basedir}?... You can use the basename task to get
the last element of a path.
> 
> I need a property to = "Dirc". (1st character
> uppercased, if possible.)
> 
Changing case is more problematical.  I would either
try ant-contrib's propertyregex (though I'm not good
with changing case in regular expressions either),
write something in Java, or deal with the case as-is. 
Others might use a script.

> For the pros out there it should be 123, but for
> me... forget it!

HTH,
Matt
> 
> Thanks
> -nat



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250

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