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.
<target name="copytest">
<!-- copy all files in test1 and test2 into test3 -->
<copy todir="E:/test3">
<path>
<pathelement path="C:/test1;D:/test2"></pathelement>
</path>
</copy>
</target>
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!
<pathelement>
generally uses it's path
attribute as a reference to classpath
or some other predefined location, if you want to give specific file locations outside of the classpath try with location
attribute
<pathelement location="D:\lib\helper.jar"/>
The location attribute specifies a single file or directory relative to the project's base directory (or an absolute filename), while the path attribute accepts colon- or semicolon-separated lists of locations. The path attribute is intended to be used with predefined paths - in any other case, multiple elements with location attributes should be preferred.