Laszlo Szabo wrote:
I'm trying to copy a subdirectory and its contents when it is separated from
the root directory by a couple of directories that are machine generated and
therefore have variable names.
For example in the following directory structure:
C:\BUILDS\Proj1_Code\devbuild\385633b5\f0e5959c\ejbModule
The 'root' directory for the build is C:\BUILDS\Proj1_Code\devbuild
The generated directories are 385633b5 and f0e5959c
The directory that I want to copy is ejbModule.
Is there an easy way to do this? The following copies everything below the
root which is not what I want (I only want ejbModule and its contents).
<copy todir="${build.dir}/test" >
<fileset dir="C:/BUILDS/Proj1_Code/devbuild">
<include name="**/ejbModule/**"/>
</fileset>
Ok, so the problem is you want to strip out the machine generated
directories?
For this you can use a mapper in the copy, that provides rules as how to
rename things. I fear the mapper in question is the <regexp> mapper,
which means you get a chance to work out the regular expression needed
do to the mapping; something that matches on (and discards) the machine
directories, but maps down everything below the ejbmodule.
Having a quick look at the mappers manual page, I think it would be
something like this:
<copy todir="${build.dir}/test" >
<fileset dir="C:/BUILDS/Proj1_Code/devbuild">
<include name="**/ejbModule/**"/>
</fileset>
<regexpmapper handledirsep="true"
from="^(.*)/ejbModule/(.*)$$&" to="ejbModule/\2"/>
</copy>
But be warned, I rarely use this mapper, and am very ignorant. I'd do
lots of -verbose runs to get it right
Let us know how it works, and we can add a new example for the documentation
-steve
--
Steve Loughran http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]