Hi everyone,

I'm having problems setting a task to delete everything in a
particular directory. But wait, before you say "this is a FAQ", I've
tested the solution given in the manual and FAQ, and it doesn't
actually work.

My task looks like this, as per standard instructions (autosrc is a
tree of source code generated by Axis2):

        <target name="codegen.clean">
                <delete verbose="true" includeEmptyDirs="true">
                        <fileset dir="autosrc" includes="**/*"/>
                </delete>
        </target>

Below is a direct cut-and-paste from my terminal window when I run it
twice, with an ls before, between and after. You'll notice that the
first time it runs, it recursively removes all the FILES from the
autosrc directory, but not the empty directories, despite the
includeemptydirs="true". Fair enough, I thought, perhaps they don't
count as empty unless they're empty when the task is invoked. But,
look at the second run -- this time it does nothing at all.


17:20:52 0 jobs [EMAIL PROTECTED] ~/data/GanymedeWorkspace/cathws
(394) bash $ ls autosrc
info  org

17:22:05 0 jobs [EMAIL PROTECTED] ~/data/GanymedeWorkspace/cathws
(395) bash $ AXIS2_HOME=axis2-1.3/ ant -v codegen.clean
Apache Ant version 1.6.5 compiled on January 6 2007
Buildfile: build.xml
Detected Java version: 1.5 in: /export/people/clegg/java/jdk/jre
Detected OS: Linux
parsing buildfile
/export/people/clegg/data/GanymedeWorkspace/cathws/build.xml with URI
= file:///export/people/clegg/data/GanymedeWorkspace/cathws/build.xml
Project base dir set to: /export/people/clegg/data/GanymedeWorkspace/cathws
 [property] Loading Environment env.
Build sequence for target(s) `codegen.clean' is [codegen.clean]
Complete build sequence is [codegen.clean, init, jar.xbeans,
pre.compile.test, compile.src, echo.classpath.problem, jar.server,
make.repo, codegen, jar.client, jar.all, compile.test, run.test,
clean, start.server, ]

codegen.clean:
   [delete] Deleting 327 files from
/export/people/clegg/data/GanymedeWorkspace/cathws/autosrc
   [delete] Deleting
/export/people/clegg/data/GanymedeWorkspace/cathws/autosrc/info/cathdb/ws/grid/MonitorMessageReceiverInOut.java
   [delete] Deleting
/export/people/clegg/data/GanymedeWorkspace/cathws/autosrc/info/cathdb/ws/grid/MonitorSkeleton.java
   [delete] Deleting
/export/people/clegg/data/GanymedeWorkspace/cathws/autosrc/info/cathdb/ws/grid/MonitorSkeletonInterface.java
[MANY SIMILAR LINES SNIPPED]
   [delete] Deleting
/export/people/clegg/data/GanymedeWorkspace/cathws/autosrc/org/xmlsoap/schemas/soap/encoding/impl/UnsignedShortDocumentImpl.java
   [delete] Deleting
/export/people/clegg/data/GanymedeWorkspace/cathws/autosrc/org/xmlsoap/schemas/soap/encoding/impl/UnsignedShortImpl.java

BUILD SUCCESSFUL
Total time: 0 seconds

17:22:09 0 jobs [EMAIL PROTECTED] ~/data/GanymedeWorkspace/cathws
(396) bash $ ls autosrc
info  org

17:22:11 0 jobs [EMAIL PROTECTED] ~/data/GanymedeWorkspace/cathws
(397) bash $ AXIS2_HOME=axis2-1.3/ ant -v codegen.clean
Apache Ant version 1.6.5 compiled on January 6 2007
Buildfile: build.xml
Detected Java version: 1.5 in: /export/people/clegg/java/jdk/jre
Detected OS: Linux
parsing buildfile
/export/people/clegg/data/GanymedeWorkspace/cathws/build.xml with URI
= file:///export/people/clegg/data/GanymedeWorkspace/cathws/build.xml
Project base dir set to: /export/people/clegg/data/GanymedeWorkspace/cathws
 [property] Loading Environment env.
Build sequence for target(s) `codegen.clean' is [codegen.clean]
Complete build sequence is [codegen.clean, init, jar.xbeans,
pre.compile.test, compile.src, echo.classpath.problem, jar.server,
make.repo, codegen, jar.client, jar.all, compile.test, run.test,
clean, start.server, ]

codegen.clean:

BUILD SUCCESSFUL
Total time: 0 seconds

17:22:13 0 jobs [EMAIL PROTECTED] ~/data/GanymedeWorkspace/cathws
(398) bash $ ls autosrc
info  org


I've seen a lot of questions about this topic on the web that just
repeat the instructions from the manual, but they just don't work as
described. It doesn't remove the empty directories no matter how many
times I run it.

Any ideas? Please don't say "just delete the directory and re-create
it" because then it becomes disconnected from Subversion, and I want
to maintain version history on auto-generated code just as much as I
want it on normal code. And besides, that answer doesn't address the
fact that a manual page and FAQ both appear to be wrong...

Thanks,

Andrew.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to