How to remove symbolic links with phing?

How can I remove symbolic links using phing so that it also works on Windows?

Creating a symlink is easy and cross-plattform works:

<symlink target="${sharedPath}zend-framework/ZendFramework-${version.zf}/library/Zend/" link="library/Zend" /> 

But neither

 <delete dir="symlinked folder" /> 

neither

 <delete file="symlinked folder" /> 

will delete the symlink.

How to do it?


Additional Information:

  • I am running phing 2.4.10
  • Phing actually outputs the [delete] path to the remote file / folder, but the symlink is still there. therefore there is no error message and no apparent failure.
+4
source share
1 answer

This is because the symbolic link you create on Windows is not a real symbolic link, but rather a .LNK file. So this is a directory, but not a link. Thus, deleting as a file will not work.

Thus, you cannot use some special windows functions to create an actual symbolic link (but the existence of these depends on the version and / or privileges), for example, see http://technet.microsoft.com/en-us/sysinternals/bb896768 for more information about the connection) or use some scary method for testing if this file is a .LNK file (see http://www.php.net/manual/en/function.is-link.php#91249 )

+2
source

Source: https://habr.com/ru/post/1396314/


All Articles