Gradle Delete task follows NTFS junction points when followSymlinks=false

Gradle Version: 2.14.1
Operating System: Windows 7 (64bit)

A NTFS Junction Point is a kind of symbolic link for Windows. Junctions can be used only for the creation of links to folders, either on the same drive or different drives, but only if those drives are on the local system.

It’s possible to create junctions in NTFS (since Windows 2000) without administrative priveleges, in contrast to Windows Symbolic Link that you can use only with administrative priveleges. All of the above makes junctions very useful for creating exploded builds on Windows without actually copying files.

Steps to reproduce:

  1. Create a junction point inside Gradle build directory
mklink /J testJunctionDir C:\targetDir```
2. Run:
```gradlew.bat clean```

**Actual result:**

All content inside ```C:\targetDir``` has been deleted.

**Expected result:**

Only the junction has been deleted.

Thank you for reporting this!

It would be nice for this to work for NTFS. As I understand it we currently do not have support for symlinks on Windows at all. I also think that this is not very high on the priority list for us either. Having an external contribution for this would be great!

I just saw a Jenkins PR treating Windows junctions: https://github.com/jenkinsci/jenkins/pull/1787
This gives some indication how to check if a File is a junction.