You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Cyril Sagan <cy...@unx.sas.com> on 2005/03/01 02:27:39 UTC

woes!

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!

--Cyril

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org