1

I am trying to delete a symlink in ant script using the below line :

<symlink action="delete" link="/path/of/link/symlink"/>

But it is showing an error:

Could not create tempfile in /directory/where/symlink/points

The /directory/where/symlink/points is supposed to be read-only.

Is there a way in which I could just delete the symlink and not mess up other things? It's a part of a big script.

kenorb
  • 155,785
  • 88
  • 678
  • 743

1 Answers1

3

Symlinks pointing to read-only resources may be deleted using the <delete> Ant task.

<target name="delete-symlink">
<delete file="/path/of/link/symlink" followsymlinks="false"
      removenotfollowedsymlinks="true" />
</target>

And this is from the delete Ant task documentation:

removeNotFollowedSymlinks  Whether symbolic links (not the files/directories 
                       they link to) should be removed if they haven't been 
                       followed because followSymlinks was false or the 
                       maximum number of symbolic links was too big. Since 
                       Ant 1.8.0

Hope it works.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Riju Mahna
  • 6,718
  • 12
  • 52
  • 91