I played around with this for a while, and I couldn't do this with the
<delete> task. I also checked and symlinks aren't defined in any
resource collection either.

The problem is that Java doesn't have the concept of the symlink. If
you read the information about the optional <symlink> task, it tells
you that <symlink> uses a hack that might not work on non-Unix systems
to figure out what the symlinks are.

The only thing I can think of is a rather complex piece of strategy:

1). Use the <symlink> task to create a directory containing the symlinks
2). Now use the replace <replaceRegexp> task to remove "=.*" from each
line in the file. This will give you a list of symbolic links.
3). Now use the AntContrib <for> or <foreach> to loop through the file
and remove this particular symlink with the <symlink> task.

Of course, you could also simply use the <exec executable="rm"> by this point.


On Mon, Jun 22, 2009 at 4:22 PM, jscripter<pc88m...@gmail.com> wrote:
>
> I am using this target definition to remove all the files under ${TOP} which
> contains some symlinks to other directories:
>
>    <target name="clean">
>        <delete includeEmptyDirs="true" failonerror="false">
>            <fileset dir="${TOP}" followsymlinks="false"/>
>        </delete>
>    </target>
>
> However, I've noticed that delete is not deleting the symlinks.
>
> I'd like to get the same results as /bin/rm -rf under Unix, i.e. the
> symlinks are deleted but not followed. Is there a way to do that with the
> delete task?
> --
> View this message in context: 
> http://www.nabble.com/Making-the-delete-task-behave-like--bin-rm--rf-vis-a-vis-symlinks-to-directories-tp24154698p24154698.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
>
>



-- 
David Weintraub
qazw...@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to