wood burning stoves*
The moose likes Ant, Maven and Other Build Tools and the fly likes Basic Ant excludes question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Basic Ant excludes question" Watch "Basic Ant excludes question" New topic
Author

Basic Ant excludes question

Joe Gliniecki
Greenhorn

Joined: Oct 25, 2007
Posts: 18
I'm trying to copy some files from one directory to another with the exception of a sub-directory. I'm running ant in Eclipse and created a simple project to reproduce my problem.

Directories and files in Eclipse project:
build.xml
dir1/a.txt
dir1/dir2/b.txt
dir3/

I want to copy a.txt to dir3, but do not want to copy b.txt at all.

This is my build.xml:


Running the build.xml results in this file structure:
dir3/a.txt
dir3/dir2/b.txt

I know I must be missing something very basic. To me, the <exclude name="dir1/dir2/**" /> should prevent anything in dir1/dir2/ from being copied.

Thanks in advance for your help!
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

It should be:


The exclude is relative to the fileset.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Ant excludes question
 
Similar Threads
What does ${user.home} means ? Where is build .properties ?
Question on Ant script error in my build.xml file in the Eclipse IDE
Development: trouble with import and classpath
Web app deployment model depends on build.xml? (Lomboz)
Error while running "war" task (Resolved)