File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes How to copy files from different directories in Ant Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "How to copy files from different directories in Ant" Watch "How to copy files from different directories in Ant" New topic
Author

How to copy files from different directories in Ant

Cainiao Zou
Ranch Hand

Joined: Mar 03, 2009
Posts: 36
I'm using Ant 1.7, want to copy files from different paths (they have no relationship, so i cannot use the include selector to filter them out of their root directory). I try to use the <path> inside the <copy> instead of <fileset>, because with <path> i can specify multi paths which is in <fileset> not possible. My ant script looks like this, but it doesn't work.



Anybody has idea about how to use the <path> inside <copy>? Or maybe anybody has the advise about how to copy files from different source without selector?

Btw, i don't want to hard code the source directories, they will be read from a propertiy file, so writing multi <fileset> inside <copy> should not be considered.

thanks in advance!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5533

Btw, i don't want to hard code the source directories, they will be read from a propertiy file, so writing multi <fileset> inside <copy> should not be considered.

Do you mean to say that you don't know how many directories will be copied and that each time it could be different? And therefore you cannot use <fileset>s because you don't know how many you need? If so, you might have to install the antcontrib library and use one of its loop tasks to run the <copy> task multiple times, each time specifying a another source directory.


JBoss In Action
 
I agree. Here's the link: http://jrebel.com/download
 
subject: How to copy files from different directories in Ant
 
Similar Threads
Classpath problems(?)
Where is documentation for ant task schemaexport
Using Ant in Eclipse
Spring : DefaultAnnotationHandlerMapping not mapping URL using annotation
Problem including external jar to build.xml file Ant