> I'm trying to use the ant copy task to copy a directory plus all its
> contents and subdirectories to a new directory e.g.
[quoted text clipped - 5 lines]
> I want to execute the copy task on d:\temp\dir1 and end up with
> c:\temp\dir1
<not sure>
Make the target directory "c:\temp\dir1" or "c:\temp\dir1\" ?
</not sure>
I am pretty sure that ANT offers either
- automatic directory creation, or..
- the ability to make the directory specifically.
As an aside, your use of file/directory naming appears 'suspicious'.
1) If a drive is 'C' - I strongly recommend you refer to it
as 'C', rether than 'c'. Remove possible errors before they are
encountered in some possibly fragile code.
2) A quick check of some of the ANT build.xml's on my
system, (largely obtained from folks that know what
they are doing), use the '/' consistently, and these
build files work just fine on Windows. I suggest you
use forward slashes.
So 'c:\temp\dir1' -> 'C:/temp/dir1'
HTH

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
dxd@ptc.com - 23 Jun 2005 23:18 GMT
Thanks Andrew,
I guess that might work (I'm at home tonight I'll try it in the office
tomorrow) but trouble is, I don't want to have to parse the source
directory to extract the name of the last directory then append it onto
the target directory. I'm not even sure if you could do this in Ant but
even if you can (and of course I could embed Javascript to do it) it
would look a real mess.
In fact I simplified my real code in my post, so I'm not concerned
about backslash versus forward slash, I do handle this OK in the
script.
It looks like it's just a limitation of both <copy> and xcopy, but a
bit of a pain!
David
> > I'm trying to use the ant copy task to copy a directory plus all its
> > contents and subdirectories to a new directory e.g.
[quoted text clipped - 34 lines]
> http://www.1point1C.org/ Science & Technology
> http://www.LensEscapes.com/ Images that escape the mundane
dxd@ptc.com - 28 Jun 2005 12:09 GMT
This approach did work, but I ended up embedding javascipt (which I
didn't want to do, because I didn't want any dependency on additional
libraries) so that I could get the last name of the source folder and
construct the name of the target folder. Not very elegant!
David
> Thanks Andrew,
>
[quoted text clipped - 52 lines]
> > http://www.1point1C.org/ Science & Technology
> > http://www.LensEscapes.com/ Images that escape the mundane
Raymond DeCampo - 28 Jun 2005 14:51 GMT
Please do not top post on a thread where bottom posting has been the norm.
> This approach did work, but I ended up embedding javascipt (which I
> didn't want to do, because I didn't want any dependency on additional
[quoted text clipped - 50 lines]
>>>
>>>So 'c:\temp\dir1' -> 'C:/temp/dir1'
Did you try setting the context directory to be the parent directory of
the directory you want to copy and then include only the desired
directory via filters? That is, in high level language, tell ANT to
recursively copy all files/directories named "dir1" from D:/temp to C:/temp?
Ray

Signature
XML is the programmer's duct tape.