markus
markus

Reputation: 40675

How to delete symlinks with phing?

How can I delete symlinks with phing so it will work on Windows too?

Creating a symlink is easy and works cross-plattform:

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

But neither

<delete dir="symlinked folder" />

nor

<delete file="symlinked folder" />

will remove the symlink.

How to do this?


Additional information:

Upvotes: 4

Views: 1502

Answers (1)

ts.
ts.

Reputation: 10709

That's because symlink which you are creating on Windows, is not a real symlink, but rather .LNK file. So, it is a directory, but not a link. Thus, deleting as a file wont work.

So you can neither use some windows special exec to create actual symlink (but existence of those depends of version and / or privileges - look for example at http://technet.microsoft.com/en-us/sysinternals/bb896768 for details on junction), or use some scary method for testing if given file is in fact a .LNK file (see http://www.php.net/manual/en/function.is-link.php#91249)

Upvotes: 2

Related Questions