This works like a charm.  Thanks again for the help!

- Bill

-----Original Message-----
From: Scot P. Floess [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 31, 2006 4:39 PM
To: Ant Users List
Subject: Re: Copying files from dirs specified by libpath

William:

It seems I do this far too often and am corrected as there may be some 
stock ant task to do what you want ;)  However, you can use ant-contrib 
tasks - specifically <for> or <foreach> which will give you iterative 
capabilities over a list/path.  If you "wrap" that in a macrodef, well 
you can make it even prettier...

For instance:

<project  name = "copy">
    <taskdef  resource = "net/sf/antcontrib/antlib.xml"/>

    <macrodef  name = "copy-ref-id">
        <attribute  name = "dest-dir"/>
        <attribute  name = "dir-ref"/>

        <sequential>
            <mkdir dir = "@{dest-dir}"/>
            <var   name = "FILE_LIST"  unset = "true"/>
            <pathconvert property = "FILE_LIST"  refid = "@{dir-ref}"/>

            <for param = "dir"  list = "${FILE_LIST}"  delimiter = 
"${path.separator}">
                <sequential>
                    <copy todir = "@{dest-dir}">
                        <fileset dir = "@{dir}" includes = "**/*"/>
                    </copy>
                </sequential>
            </for>
        </sequential>
    </macrodef>
</project>

Now, to call the above...lets assume you actually use a libpath refid...

<copy-ref-id dest-dir = "/home/william/repo" dir-ref = "libpath"/>

Hope that helps...

Scot

William Press wrote:
> Yes, that's correct.
>
> -----Original Message-----
> From: Scot P. Floess [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, May 31, 2006 4:08 PM
> To: Ant Users List
> Subject: Re: Copying files from dirs specified by libpath
>
> William:
>
> So, just to clarify you want to iterate over each directory in libpath

> and copy the files from each into a directory?
>
> William Press wrote:
>   
>> Greetings,
>>
>>  
>>
>> I have a libpath reference I'd like to use for copying files.
>> Specifically, the libpath reference contains a list of directories,
>>     
> and
>   
>> I would like to copy all of the files contained in these directories
>> into a target directory.
>>
>>  
>>
>> I realize I can convert this into a comma-delimited list of
>>     
> directories
>   
>> using <pathconvert>, but it doesn't seem there's a way of deriving a
>> fileset from this comma-delimited list.
>>
>>  
>>
>> Has anybody here solved this before?
>>
>>  
>>
>> Thanks,
>>
>> Bill
>>
>>
>>   
>>     
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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

Reply via email to