ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Sagan <>
Subject <delete dir="X/Y"> woes!
Date Tue, 01 Mar 2005 01:27:39 GMT

I'm loosing my mind trying to get Ant to delete a directory!

I thought this was easy, until I was sent a path property that
included multiple directory components.

The obvious was working:
    <delete dir="${base}" verbose="true" includeEmptyDirs="true" />

...until I was given a path in the form "dirX/dirY".

The result was to remove "dirY" and all its contents, but leave an
empty "dirX".  Yes, I could use <dirname>:
    <dirname file="${base}" property="top"/>
    <delete dir="${top}" verbose="true" includeEmptyDirs="true" />

...but this is no good for arbitrary paths, failing with something as
simple as "dirX/dirY/dirZ".

I solved this with a trivial shell exec to return the "highest level"
directory component, but this didn't seem to be the "Ant way".  If
anyone has any better ideas, I'd be very interested in hearing them.

Thanks!!  I'm stumped!


ps.  I'm using Ant 1.6.2.  The base directories are created as a
result of an <ftp> get operation embedded in my build.xml.  The
problem would go away if <ftp> allowed the local path to be different
from the remote.

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

View raw message