ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Getting the filename from a property
Date Thu, 28 Feb 2002 00:25:20 GMT
--- Diane Holt <> wrote:
> --- Brian DeWeese <> wrote:
> > What would be the best way to get just the filename from a property
> > whose value is a fully qualified path?
> > 
> > Such as get "foo.txt" from "d:\dir1\dir2\foo.txt".
>  <property name="foodir" location="d:/dir1/dir2"/>
>  <target name="doFilename">
>     <pathconvert pathsep="${file.separator}" property="filename">

Oh wait -- that would require you to know the leading path, and in which
case, there wouldn't really be any need for you to go through any voodoo
to find out the filename (doh!).  So I suspect you need some way to get
the filename off a path you don't know, right?  In that case, I can only
think of two ways: 1) <exec> 'basename', if you're all *nix all the time,
or 2) otherwise, use <script> (I wrote one to do that, if you want it).
Oh, I thought of a third, if you can use 1.5alpha -- <propertyfile> the
property out to a file (using a new name for what will become the
just-the-filename property), <replaceregexp> the value down to just the
filename, then read the properties file in.



Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!

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

View raw message