I figured it out.  There were extraneous spaces in the file list, so the
list really looked like this:
"    /foo/bar/myfile.jar,     /goo/car/myotherfile.jar"

This is due to the formatting in the property file where these are
defined. 

I removed the spaces with a regex:

                <propertyregex property="postcompile.files.lib.remote"
                        input="${files.lib.remote}"
                        regexp="^\s+|,\s+"
                        replace=","
                        global="true" />

This puts an extra comma at the beginning, but that seems to be okay.


-----Original Message-----
From: Paul Faulstich [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 21, 2005 4:25 PM
To: Ant Users List
Cc: Eric Wood
Subject: 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
[EMAIL PROTECTED]
www.llbean.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to