You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Md. Jahidul Hasan" <ja...@bjitgroup.com> on 2008/04/01 07:53:02 UTC

how to find the drive name from a file fath ?

Is there any task to find the drive name from a given file/directory path
? "dirname"  task can't help in this regards as it takes the full path
until that filename. I only need that drive name.

Thanks
Hasan



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


Re: how to find the drive name from a file fath ?

Posted by Matt Benson <gu...@yahoo.com>.
--- "Md. Jahidul Hasan" <ja...@bjitgroup.com>
wrote:

> Is there any task to find the drive name from a
> given file/directory path
> ? "dirname"  task can't help in this regards as it
> takes the full path
> until that filename. I only need that drive name.

Ant 1.7.0, untested:

<property name="normalizedPath"
location="${givenPath}" />
<pathconvert>
  <first>
    <tokens>
      <string value="${normalizedPath}" />
      <stringtokenizer delims="${file.separator}" />
    </tokens>
  </first>
</pathconvert>

If by chance you want to work with svn trunk, it is
compatible with the experimental props antlib that
intends to provide this functionality inside a
property expression.

HTH,
Matt

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



      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

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