You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Paul Faulstich <pf...@llbean.com> on 2005/11/21 22:24:54 UTC
Copying specific files with full path specified
I am trying to copy a list of files, which have fully qualified paths
EG: "/foo/bar/myfile.jar, /goo/car/myotherfile.jar"
or "F:\foo\bar\myfile.jar, G:\goo\car\myotherfile.jar"
Any advice on how to do this? (I'm using 1.6.5)
The following approaches do not work:
(1) use for loop. For example:
<for param="file" list="${files.lib.remote}">
<sequential>
<copy file="@{file}"
todir="${dir.dist.uses}"/>
</sequential>
</for>
This approach generates this message:
Warning: Could not find file /build/path/ /foo/bar/myfile.jar to
copy.
(2) use pathtofileset. For example:
<path id="postcompile.files.remote">
<filelist
dir="/"
files="${files.lib.remote}" />
</path>
<pathtofileset
dir="/"
pathrefid="postcompile.files.remote"
name="postcompile.path.remote" />
<copy todir="${dir.dist.uses}">
<fileset refid="postcompile.path.remote" />
</copy>
This approach yields:
/foo/bar/myfile.jar is not relative to /
BTW, my research of past postings shows that this (or a similar) topic
was covered in posts on the following dates:
2005-10-04: Jan Materne, Steve Loughram, et al discuss changes to copy
in 1.7 (Subject: Copy files according ant property)
2004-03-18: Jan Materne & Stefan Rufer - first approach suggested
(Subject: How to copy absolute paths)
2003-08-11: Adam Hardy & Peter Reilly discuss modifying <copy> to accept
filelists (Subject: "Copy" accepts FileList without any directory
limitation - enhancement?)
--
Paul Faulstich
Systems Analyst
L.L. Bean, Inc.
Freeport, ME 04033
(207) 552-2294
pfaulstich@llbean.com
www.llbean.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Copying specific files with full path specified
Posted by Dominique Devienne <dd...@gmail.com>.
> I am trying to copy a list of files, which have fully qualified paths
>
> EG: "/foo/bar/myfile.jar, /goo/car/myotherfile.jar"
> or "F:\foo\bar\myfile.jar, G:\goo\car\myotherfile.jar"
>
> (1) use for loop. For example:
>
> <for param="file" list="${files.lib.remote}">
> <sequential>
> <copy file="@{file}"
> todir="${dir.dist.uses}"/>
> </sequential>
> </for>
>
> This approach generates this message:
> Warning: Could not find file /build/path/ /foo/bar/myfile.jar to copy.
If I remember right, you can't have spaces after the comma.
Plus I think you'd need to use <copy file="" tofile="">, and not
todir="", no? Maybe using file+todir does an implicit flatten mapper?
I've only ever used file+tofile, and filesets+todir, where the
relative path in the fileset to appended to todir.
OK file+todir seems a valid combi from the manual, but it's unclear
whether it flattens or not. I would guess yes, similar to a cp unix
command.
> (2) use pathtofileset. For example:
> /foo/bar/myfile.jar is not relative to /
This sounds a bit like a bug. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org