You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Narahari 'n' Savitha <sa...@gmail.com> on 2006/05/06 06:08:38 UTC
file list without directory prepended how to get it
Consider this scenario friends.
build.xml
|
|------------lib
|
|----------averyveryverylong.jar
|----------anotherlongjarfile.jar
now when I want to build a list of files in the lib folder I am using
<fileset dir="lib" id="hi">
<include file=".jar" /<
</fileset>
I then use pathconvert
<pathconvert pathsep="," property="testing" refid="hi" />
what I am getting is
c:\lib\averyveryverylong.jar,c:\lib\anotherlongjarfile.jar
but that is not what I am expecting.
I am expecting just averyveryverylong.jar, anotherlongjarfile.jar
Can you help me out as to how to get this ?
-N
Re: file list without directory prepended how to get it
Posted by "Ivan \"Rambius\" Ivanov" <ra...@yahoo.com>.
Hello,
--- Narahari 'n' Savitha <sa...@gmail.com> wrote:
> Consider this scenario friends.
>
> build.xml
> |
> |------------lib
> |
>
> |----------averyveryverylong.jar
>
> |----------anotherlongjarfile.jar
>
> now when I want to build a list of files in the lib
> folder I am using
> <fileset dir="lib" id="hi">
> <include file=".jar" /<
> </fileset>
>
> I then use pathconvert
>
> <pathconvert pathsep="," property="testing"
> refid="hi" />
You should consider <pathconvert> with a <mapper>:
<property name="fs" value="${file.separator}"/>
<pathconvert pathsep="," property="testing"
refid="hi">
<globmapper from="${basedir}${fs}lib${fs}*.jar"
to="*.jar"/>
</pathconver>
Regards
Ivan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: file list without directory prepended how to get it
Posted by an...@tcs.com.
Hi savitha,
have u ever tried antelope jar. It's very good extention of ant and has a
lot of interesting tasks. (eg. if -else etc.)
now for ur problem. It can be done very easily using fileutil task in
antelope.jar
something like this:
<taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask"/>
<target name="abc">
<fileutil file="${out_dir}" property="file_list">
<listfiles includepath="no"/>
</fileutil>
</target>
include path is the key here for ur problem.
for antelope reference use this url : http://antelope.tigris.org/
cheers!!
Ankur Agarwal
Tata Consultancy Services Limited
Mailto: ankur1.a@tcs.com
Website: http://www.tcs.com
"Narahari 'n' Savitha" <sa...@gmail.com>
05/06/2006 09:38 AM
Please respond to
"Ant Users List" <us...@ant.apache.org>
To
user@ant.apache.org
cc
Subject
file list without directory prepended how to get it
Consider this scenario friends.
build.xml
|
|------------lib
|
|----------averyveryverylong.jar
|----------anotherlongjarfile.jar
now when I want to build a list of files in the lib folder I am using
<fileset dir="lib" id="hi">
<include file=".jar" /<
</fileset>
I then use pathconvert
<pathconvert pathsep="," property="testing" refid="hi" />
what I am getting is
c:\lib\averyveryverylong.jar,c:\lib\anotherlongjarfile.jar
but that is not what I am expecting.
I am expecting just averyveryverylong.jar, anotherlongjarfile.jar
Can you help me out as to how to get this ?
-N
ForwardSourceID:NT0000C8D6
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you