ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <>
Subject Re: Delete files from dir-1 where file name same as a file in dir-2
Date Tue, 28 Sep 2010 20:22:12 GMT
Not 100% sure what you're asking. Let me get a synopsis:

1. You have two "source" folders: One contains "generated" *.java
files. (I'm assuming *.java). The other contains *.java that you've
2. When you compile, you want the files in the "hand coded" *.java
files to be used instead of the ones in the "generated" sources file.

My solution (since these are source files is to first copy the
"generated" *.java files into a third folder, then copy over the "hand
coded" *.java files with "overwrite". That'll overwrite any files with
the same name with the "generated" ones deleted and the "hand coded"
ones kept.

Then, you compile the third source folder (the one you've copied all
the files to). This will save you from compiling source code that
isn't needed.

Is this what you want?

On Mon, Sep 27, 2010 at 4:32 PM, Michael Giroux <> wrote:
> I have two source folders in my project.  On folder contains files
> that are generated by the build, and a second folder contains our
> hand-coded sources.   If cases where package and class names are the
> same, we only want to include the sources from the hand-coded src
> tree, so we need to delete corresponding files from the generated src
> folder.
> The script should
> 1. generate src
> 2. delete files from generated folder that have same package/class
> names as files in the src tree
> 3. compile
> I'm looking at the <delete> and <resources> descriptions, but so far,
> not able to build a delete task that does what I need.  Reading the
> docs, it looks like I should be able to accomplish this:
> <delete dir="generated">
> <restrict>
> <intersect>
> <fileset dir="generated/*.java"/>
> <fileset dir="src/*.java"/>
> </intersect>
> </restrict>
> </delete>
> {{ syntax incomplete }}
> Up to now, the delete is removing every file from the generated directory.
> Any pointers will be appreciated.
> Michael
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

David Weintraub

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message