Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't delete a symlink using ANT Script

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

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

It throws an error saying:

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 ?

like image 512
Riju Mahna Avatar asked Feb 18 '23 22:02

Riju Mahna


1 Answers

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>

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
like image 146
Christopher Peisert Avatar answered Mar 07 '23 00:03

Christopher Peisert